# CDP's Agentkit Starter Template

## Overview

This template shows an onchain agent powered by Coinbase's AgentKit with the Next.js framework on the frontend and LangGraph for the agent's setup. The agent is designed for AI-driven on-chain capabilities.

AgentKit handles these interactions by using a Gaia node for Large Language Model (LLM) inferencing.

![cdp-image](../cdp/cdp-image.png)

## Features

- **AI-Driven on-chain interactions**: Leverages AgentKit to enable AI agents to perform actions on blockchain networks.

- **Bootstrapped**: Built as a Next.js project with a LangGraph in the server, bootstrapped with `npm create onchain-agent@latest`.

- **Configurable LLM**: Supports integration with LLMs hosted on Gaia nodes, specifically configured for tool use inferencing (e.g., [Llama-3-Groq-8B-Tool](https://github.com/GaiaNet-AI/node-configs/tree/main/llama-3-groq-8b-tool), [Llama-3.3-70B-Instruct-Q5_K_M](https://llama70b.gaia.domains/v1/info)).

- **Wallet management**: Integrates with a `SmartWalletProvider` for blockchain interactions, with persistent wallet data management.

- **Extensible actions**: Utilizes various Action Providers (e.g., WETH, Pyth, ERC20, CDP API, Wallet actions) to define the agent's capabilities.

- **Chat interface**: Provides a user-friendly chat interface for interacting with the agent.

- **Streamed responses**: Agent responses are streamed for a more interactive user experience.

- **Memory**: Incorporates memory for conversations using `MemorySaver` from LangGraph.

## Getting started

### Prerequisites

1. Node.js 18 or later is installed
2. Confirm that npm 9 or later is installed

Check your Node.js and npm versions:

```bash
node --version  # Should be 18+
npm --version   # Should be 9+
```

3. You can use either a public Gaia node for example: [https://llama70b.gaia.domains/v1](https://llama70b.gaia.domains/v1) or [run the node locally](https://github.com/GaiaNet-AI/node-configs/tree/main/llama-3-groq-8b-tool).

### Creating a new project

You can use the CLI to bootsrap a new Agenkit project with the command below:

```bash
npm create onchain-agent@latest
```

Follow the instructions on the CLI to setup your project and choose the Smart wallet (default) option for the setup. You can also make a framework choice among:

- LangChain
- Vercel AI SDK

There is also an Model Context Protocol (MCP) option, but, in this guide, we cover using the LangChain option.

### Configure secrets and values

Rename the `.env.example` to `.env` and ensure that you have the below values:

```bash
CDP_API_KEY_NAME=
CDP_API_KEY_PRIVATE_KEY=