# Optional
NETWORK_ID=base-sepolia
```

To obtain the values for `CDP_API_KEY_NAME` and `CDP_API_KEY_PRIVATE_KEY` head over to [CDP portal](https://portal.cdp.coinbase.com/projects/api-keys) to create a new API key. Copy the API key name and private key values from the modal that appears.

The `NETWORK_ID` can stay as `base-sepolia` and you can explore the possible [network options](https://docs.cdp.coinbase.com/api-reference/networks#network-identifiers) as well.

## Project structure

```bash
└── onchain-agent/
    ├── README.md
    ├── next-env.d.ts
    ├── next.config.js
    ├── package.json
    ├── postcss.config.mjs
    ├── tailwind.config.ts
    ├── tsconfig.json
    ├── wallet_data.txt
    ├── .eslintrc.json
    ├── .npmignore
    ├── .yarnrc.yml
    └── app/
        ├── globals.css
        ├── layout.tsx
        ├── page.tsx
        ├── api/
        │   └── agent/
        │       ├── create-agent.ts
        │       ├── prepare-agentkit.ts
        │       └── route.ts
        ├── hooks/
        │   └── useAgent.ts
        └── types/
            └── api.ts
```

## Gaia Integration

:::info
A local Gaia node does not require an API key. You will need a [Gaia API key](https://www.gaianet.ai/setting/gaia-api-keys) to use public nodes.
:::

The LLM inferencing is offloaded to a Gaia node:

- The LLM is configured in `app/api/agent/create-agent.ts`.
- The project uses `ChatOpenAI` from `@langchain/openai` to connect to the Gaia node.
- The specific model configured is "Llama-3-Groq-8B-Tool".
- The Gaia node endpoint is set via the `baseURL` in the `ChatOpenAI` configuration:

For example with a local node running on a machine:

```ts
const llm = new ChatOpenAI({
  model: "Llama-3-Groq-8B-Tool",
  configuration: {
    baseURL: "https://YOUR_NODE_ID.gaia.domains/v1", // Gaia node URL
    apiKey: "gaia", // API key for the Gaia node (if required)
  },
});
```

## Run template

The below command runs the template:

```bash
npm run dev
```

With the template running, there a few example prompts you can use to test the agent:

- "What is your wallet address?"
- "What is your wallet balance? Check and confirm."
- "Share your wallet details including every relevant information."

## Documentation

For further information and advanced topics, refer to the following official documentation:

- **AgentKit Documentation**:

  - GitHub: https://github.com/coinbase/agentkit
  - CDP Docs: https://docs.cdp.coinbase.com/agentkit/docs/welcome

- **GaiaNet Documentation**:

  - Gaia Node Setup (example Llama-3-Groq-8B-Tool): https://github.com/GaiaNet-AI/node-configs/tree/main/llama-3-groq-8b-tool

- **Coinbase Developer Platform (CDP)**: https://docs.cdp.coinbase.com/

---

## DynamicRAG