# Coinbase AgentKit

FervusAI provides a `FervusAIActionProvider` for Coinbase AgentKit, enabling AgentKit-based agents to pay for services using a FervusAI wallet governed by spending policy.

***

## Installation

```bash
npm install @fervusai/agentkit-provider
```

***

## Setup

```typescript
import { AgentKit } from "@coinbase/agentkit";
import { FervusAIActionProvider } from "@fervusai/agentkit-provider";

const fervusProvider = new FervusAIActionProvider({
  apiKey: process.env.FERVUS_API_KEY,
  walletId: process.env.FERVUS_WALLET_ID,
});

const agentKit = await AgentKit.from({
  // ... your existing AgentKit config
  actionProviders: [fervusProvider],
});
```

***

## Actions registered

| Action                | Description                                            |
| --------------------- | ------------------------------------------------------ |
| `fervus_pay`          | Send USDC from the agent's FervusAI wallet             |
| `fervus_balance`      | Get current USDC balance                               |
| `fervus_transactions` | List recent transactions                               |
| `fervus_pay_agent`    | Initiate an A2A escrow payment to another agent wallet |

***

## Example with LangChain + AgentKit

```typescript
import { AgentKit, CdpWalletProvider } from "@coinbase/agentkit";
import { FervusAIActionProvider } from "@fervusai/agentkit-provider";
import { getLangChainTools } from "@coinbase/agentkit-langchain";
import { ChatAnthropic } from "@langchain/anthropic";
import { createReactAgent } from "@langchain/langgraph/prebuilt";

const fervusProvider = new FervusAIActionProvider({
  apiKey: process.env.FERVUS_API_KEY,
  walletId: process.env.FERVUS_WALLET_ID,
});

const agentKit = await AgentKit.from({
  walletProvider: await CdpWalletProvider.configureWithWallet({ /* ... */ }),
  actionProviders: [fervusProvider],
});

const tools = getLangChainTools(agentKit);

const agent = createReactAgent({
  llm: new ChatAnthropic({ model: "claude-opus-4-6" }),
  tools,
});

// The agent can now reason about and execute payments
await agent.invoke({
  messages: [{ role: "user", content: "Search for the latest AI research papers and pay for API access if needed." }],
});
```

***

## Environment variables

| Variable           | Description                       |
| ------------------ | --------------------------------- |
| `FERVUS_API_KEY`   | Your FervusAI API key             |
| `FERVUS_WALLET_ID` | FervusAI wallet ID for this agent |

***

## Notes

The `FervusAIActionProvider` is independent of AgentKit's built-in CDP wallet. It does not replace the CDP wallet - it adds FervusAI payment actions alongside AgentKit's existing on-chain capabilities. The two can coexist in the same agent.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fervusai.com/integrations/coinbase-agentkit.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
