An AI-powered agent that operates on the Base blockchain and interacts with users through Twitter. Built with Coinbase's CDP Agentkit, this agent can perform various blockchain operations and engage in autonomous social interactions.
- AI-powered responses
- Integration with Base mainnet and testnet
- Twitter interaction capabilities
- Responds to mentions
- Autonomous tweeting
- CDP Wallet management
- Autonomous mode for periodic engagement
- Blockchain operations (token deployment, NFT minting)
- Node.js
- Twitter Developer Account with API credentials
- OpenAI API key
- Coinbase CDP API credentials
graph TB
subgraph "User Interaction Layer"
T[Twitter Users] -.-> TW[Twitter API]
CMD[Command Line] -.-> UI[Interactive Mode]
end
subgraph "AI Agent Core"
AG[BaseAIAgent]
LLM[LLM Model<br/>GPT/Claude] --> AG
TW --> AG
UI --> AG
end
subgraph "AgentKit Default Tools"
CDP[CDP SDK] --> AK[AgentKit]
AK --> OPS[Blockchain Operations]
OPS --> |Deploy|TOK[Tokens/NFTs]
OPS --> |Execute|TX[Transactions]
OPS --> |Manage|WAL[Wallets]
end
subgraph "Custom Tools"
CT[Twitter Integration Tool]
CT -->|post_tweet| TW
end
AG <--> CDP
AG <--> CT
subgraph "Operation Modes"
AG --> AM[Autonomous Mode]
AG --> IM[Interactive Mode]
AG --> TM[Custom Twitter Mode]
end
classDef layer fill:#e1f5fe,stroke:#01579b
classDef core fill:#fff3e0,stroke:#e65100
classDef ops fill:#f3e5f5,stroke:#4a148c
classDef mode fill:#e8f5e9,stroke:#1b5e20
classDef custom fill:#fce4ec,stroke:#880e4f
class T,TW,CMD,UI layer
class AG,LLM core
class CDP,AK,OPS,TOK,TX,WAL ops
class AM,IM,TM mode
class CT,TM custom
- Clone the repository
git clone https://github.com/quiknode-labs/qn-guide-examples.git
cd ai/coinbase-ai-agent- Install dependencies:
npm install- Copy the example environment file and fill in your credentials:
cp .env.example .envThe agent can be run in two modes:
This mode runs the agent autonomously, generating periodic tweets and blockchain interactions.
npm run start:autonomousThis mode monitors Twitter for mentions and responds to user interactions.
npm run start:mentionsTo run the tests, use the following command:
npm run testThe project uses environment variables for configuration. Add the following variables into your .env file:
TWITTER_API_KEY="your-twitter-api-key"
TWITTER_API_SECRET="your-twitter-api-secret"
TWITTER_ACCESS_TOKEN="your-twitter-access-token"
TWITTER_ACCESS_SECRET="your-twitter-access-secret"
TWITTER_USER_ID="your-twitter-user-id"
OPENAI_API_KEY="your-openai-api-key"
CDP_API_KEY_NAME="your-cdp-api-key-name"
CDP_API_KEY_PRIVATE_KEY="your-cdp-api-key-private-key"- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Created as part of the Quicknode guide preparation.