What it is

Compass AI is your LLM’s gateway to DeFi. It translates natural language into structured, ready-to-use DeFi actions—whether that means executing a leveraged trade or checking a wallet’s P&L. Built on top of Compass Labs’ API, it supports both execution and monitoring, and works with any LLM supported by Langchain. Compass AI is an LLM‑friendly layer on top of the Compass API. It converts plain English (e.g., “Borrow 1,000 USDC on Aave on Base”) into structured, sign‑ready transactions or standardized data responses (balances, positions, P&L, rates).
  • Execution: returns an unsigned payload you sign.
  • Monitoring: returns data for balances, positions, APR/APY, prices, risk, and more.
Non‑custodial by design. We never hold keys or move assets.
Compass AI is officially integrated with LangChain. Use the Compass Langchain Toolkit to add DeFi to your chat interface.

When to use it

  • Add AI agents that can execute swaps, lends/borrows, LP, leverage, or rebalance.
  • Let users ask in natural language to check balances, position health, and yield.
  • Prototype agentic flows quickly without writing protocol adapters.

How it works

Each Compass API action (swap, lend, borrow, repay, withdraw, bundle, balances, positions, etc.) is exposed as a LangChain Tool with an input/output schema.
  1. User asks in plain English. The LLM parses the user’s intent, and picks the right tool. .
  2. Deterministic execution. The tool calls Compass, which returns either a sign‑ready transaction or data.
  3. You keep the keys. Payloads are unsigned. You review, sign, and broadcast. Compass never holds keys.
Why this approach? Reliability. We push as much logic as possible into deterministic tools, and keep the LLM focused on intent parsing. The result: predictable behavior and a safer UX.

Ways to Integrate

Compass AI is officially integrated with LangChain. Use the Compass Langchain Toolkit to add DeFi to your chat interface.
1

Install the langchain package

pip install -qU langchain-compass

Environment Setup

To run these examples, ensure LangChain has access to an LLM service. For instance, if you’re using GPT-4o, create a .env file containing:
# .env file
OPENAI_API_KEY=<your_openai_api_key_here>Import and instantiate the toolkit
2

Import and instantiate the toolkit

from langchain_compass.toolkits import LangchainCompassToolkit

toolkit = LangchainCompassToolkit(compass_api_key=None)
3

Pass the tools to your agent with toolkit.get_tools()

View available tools:
tools = toolkit.get_tools()
for tool in tools:
    print(tool.name)
# Expected output:

aave_supply
aave_borrow
aave_repay
aave_withdraw
aave_asset_price_get
aave_liquidity_change_get
aave_user_position_summary_get
...