Skip to main content
This guide walks you through setting up a complete Agent Node development environment in 4 steps. You’ll initialize an agent configuration, start the development server, test it with HTTP requests, and connect using the A2A SDK. This gives you a working agent with DeFi capabilities, AI integration, and workflow execution that you can immediately extend and customize for your specific use cases. For more detailed guidelines, check out the GitHub repository.

Prerequisites

Before you begin, ensure you have:

Installation

  1. Install dependencies:
    cd typescript/lib/agent-node
    pnpm install
    
  2. Set up environment:
    cp .env.example .env
    
    Edit .env and add your API keys.

Quickstart

Creates a general-purpose AI agent with DeFi capabilities in 4 steps:
1

Initialize Your Agent

pnpm cli init
This creates a config/ directory with a general-purpose AI agent that has DeFi capabilities (swapping, lending, liquidity) and web tools. You can customize it by editing config/agent.md.
2

Start the Server

pnpm cli run --dev
Your agent is now running at http://0.0.0.0:3000
3

Test Your Agent

In a different terminal, send a message to verify everything works:
curl -X POST http://0.0.0.0:3000/a2a \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "message/send",
    "params": {
      "message": {
        "kind": "message",
        "messageId": "test-1",
        "role": "user",
        "parts": [{"kind": "text", "text": "Hello! Can you help me?"}]
      }
    },
    "id": 1
  }'
Your agent is now ready to receive messages and execute workflows.
4

Connect to Your Agent

Your agent exposes these endpoints for integration:
  • A2A Endpoint: http://0.0.0.0:3000/a2a - Send messages and get responses
  • Agent Card: http://0.0.0.0:3000/.well-known/agent-card.json - Agent discovery
  • Health Check: POST to /a2a with {"jsonrpc": "2.0", "method": "health", "id": 1}
Using the A2A SDK:
import { A2AClient } from '@a2a-js/sdk/client';

const client = await A2AClient.fromCardUrl('http://0.0.0.0:3000/.well-known/agent-card.json');

const response = await client.sendMessage({
  message: {
    kind: 'message',
    messageId: 'msg-1',
    role: 'user',
    parts: [{ kind: 'text', text: 'Hello agent!' }],
  },
});

console.log(response);
I