Skip to main content

AI Agents on Orca

Orca’s Whirlpools SDK is designed for programmatic use — making it well-suited for autonomous agents that manage LP positions, execute swaps, or monitor pool conditions without human intervention. This page covers the key patterns for building an agent on top of Orca.

Why Orca for Agents

  • MCP server — native tool-use access to all Orca docs at https://docs.orca.so/mcp
  • Full SDK coverage — open, monitor, harvest, and close positions in a single SDK call each
  • REST API — read pool and token data without a wallet or on-chain connection
  • Deterministic quoting — get exact expected output amounts before submitting any transaction
  • Multi-network — works on Solana Mainnet and Solana Devnet

Using the Orca MCP Server

Orca exposes a live MCP server that any agent framework can connect to for real-time documentation search. The server provides a SearchOrcaDocumentation tool — useful for grounding agent decisions with protocol knowledge at runtime. MCP server URL: https://docs.orca.so/mcp Add it to Claude Desktop (claude_desktop_config.json) or Cursor (.cursor/mcp.json):
Or call it programmatically from inside an agent:
See LLM & AI Access for full MCP setup instructions.

The Minimal Agent Loop

A minimal autonomous LP management agent:
The four SDK operations that power this loop:

TypeScript Example (Kit SDK)

Python (REST API + whirlpool-essentials)

For Python-based agent frameworks (LangChain, CrewAI, custom loops):
See Python Integration for the full on-chain execution pattern.

Agent Framework Integrations

Orca SDK functions are straightforward to wrap as tools in any agent framework:

LangChain / LangGraph

Wrap fetchWhirlpool and swap as @tool functions. Use the REST API for read-only tools that don’t require a wallet.

CrewAI

Define a WhirlpoolMonitorTool and SwapExecutorTool as CrewAI tools. Assign them to specialist agents in your crew.

Eliza (ai16z)

Register Orca SDK calls as Eliza actions. The REST API /pools/search endpoint works well for on-demand pool lookups.

Vercel AI SDK

Use tool() to define Orca operations as typed tools. Pair with streamText or generateText for natural language LP management.

Key SDK Pages

Security Considerations

Never expose private keys in agent prompts, logs, environment variables visible to external services, or LLM context. Use a dedicated, isolated keypair for any automated agent with only the funds it needs to operate.
Additional recommendations:
  • Simulate before submitting — use quote functions (swap, openConcentratedPosition, closePosition) to verify expected outcomes before calling sendTx()
  • Set slippage limits — always pass a slippageToleranceBps value; 100 (1%) is a reasonable default for most LP operations
  • Use devnet first — the devnet test pool (SOL/devUSDC, tick spacing 8) is safe for end-to-end agent testing
  • Handle errors gracefully — catch InvalidTickIndex (0x177a) and NotRentExempt (0x0); see the error reference