Skip to main content

List Agents

Retrieve all configured agents and their current status.
curl https://api.karen.dev/api/v1/agents \
  -H "Authorization: Bearer YOUR_API_KEY"
agents
array
Array of agent configuration objects

Create Agent

Requires admin authentication
Create a new autonomous agent with custom configuration.
curl -X POST https://api.karen.dev/api/v1/agents \
  -H "Authorization: Bearer ADMIN_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "momentum-trader",
    "walletId": "wallet_abc",
    "llmProvider": "anthropic",
    "llmModel": "claude-3-opus-20240229",
    "strategy": "Trade based on momentum indicators",
    "loopIntervalMs": 60000,
    "guardrails": {
      "maxSolPerTransaction": 1.0,
      "maxTransactionsPerMinute": 3,
      "dailySpendingLimitSol": 5.0
    }
  }'
name
string
required
Agent name
walletId
string
required
Wallet ID for the agent to use
llmProvider
string
required
LLM provider: “openai”, “anthropic”, “grok”, or “gemini”
llmModel
string
required
Model identifier
strategy
string
required
Agent’s strategy description
loopIntervalMs
number
default:"60000"
Decision loop interval in milliseconds
guardrails
object
Custom guardrail configuration
id
string
Created agent ID
name
string
Agent name
status
string
Initial status (idle)

Start Agent

Requires admin authentication
Start an agent’s autonomous decision loop.
curl -X POST https://api.karen.dev/api/v1/agents/AGENT_ID/start \
  -H "Authorization: Bearer ADMIN_SECRET"
status
string
Confirmation: “started”

Stop Agent

Requires admin authentication
Stop an agent’s autonomous decision loop.
curl -X POST https://api.karen.dev/api/v1/agents/AGENT_ID/stop \
  -H "Authorization: Bearer ADMIN_SECRET"
status
string
Confirmation: “stopped”

Chat with Agent

Send a message to an agent and receive a response.
curl -X POST https://api.karen.dev/api/v1/agents/AGENT_ID/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message": "What is your current portfolio value?"}'
message
string
required
Message to send to the agent
response
string
Agent’s response message

Agent Status Values

  • idle - Agent created but not running
  • running - Agent actively making decisions
  • paused - Agent temporarily paused
  • stopped - Agent stopped
  • error - Agent encountered an error

Example Agent Workflow

# 1. Create a wallet for the agent
curl -X POST https://api.karen.dev/api/v1/wallets \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"name": "trader-wallet"}'

# Response: {"walletId": "wallet_xyz", ...}

# 2. Fund the wallet (devnet)
curl -X POST https://api.karen.dev/api/v1/wallets/wallet_xyz/airdrop \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"amount": 2}'

# 3. Create an agent (admin only)
curl -X POST https://api.karen.dev/api/v1/agents \
  -H "Authorization: Bearer ADMIN_SECRET" \
  -d '{
    "name": "my-trader",
    "walletId": "wallet_xyz",
    "llmProvider": "anthropic",
    "llmModel": "claude-3-sonnet-20240229",
    "strategy": "Conservative SOL/USDC trading",
    "guardrails": {
      "maxSolPerTransaction": 0.5,
      "dailySpendingLimitSol": 2.0
    }
  }'

# Response: {"id": "agent_abc", ...}

# 4. Start the agent
curl -X POST https://api.karen.dev/api/v1/agents/agent_abc/start \
  -H "Authorization: Bearer ADMIN_SECRET"

# 5. Chat with the agent
curl -X POST https://api.karen.dev/api/v1/agents/agent_abc/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"message": "What trades have you made today?"}'

Build docs developers (and LLMs) love