brian-api

Convert natural language prompts into executable Web3 transaction calldata via the Brian API.

6|20|Updated Mar 14, 2026
One-click install
npx skills add https://github.com/andresdefi/cryptoskills --skill brian-api-andresdefi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: brian-api
Source: https://github.com/andresdefi/cryptoskills/tree/main/skills/brian-api
Command: npx skills add https://github.com/andresdefi/cryptoskills --skill brian-api-andresdefi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing Web3 transactions by hand requires knowing contract addresses, ABI encoding, approval flows, and DEX/bridge routing across many chains. This Skill lets you turn plain-English intents like "swap 10 USDC for ETH on Base" into ready-to-sign transaction calldata through the Brian API, avoiding stale LLM knowledge about endpoints, chains, and solver routing. ## Core Features & Use Cases - Transaction Generation: The /agent/transaction endpoint returns ordered, executable calldata steps (including token approvals) for swap, bridge, transfer, deposit, withdraw, borrow, and repay actions across 14+ EVM chains plus Solana and StarkNet. - Knowledge Queries: The /agent/knowledge endpoint answers DeFi protocol questions with cited sources, useful for research agents. - LangChain Agent Integration: The @brian-ai/langchain toolkit plugs transaction tools into autonomous agents, with optional Coinbase CDP wallet support. - Use Case: Build a chat-based DeFi assistant where a user types "Deposit 1000 USDC into Aave on Arbitrum" and your backend fetches calldata from Brian, then signs and broadcasts each step with viem. ## Quick Start Ask the agent to swap 10 USDC for ETH on Base using the Brian API and execute the returned transaction steps with a viem wallet client.

Frequently Asked Questions about brian-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert a natural language prompt into a Web3 transaction?

Send a POST request to https://api.brianknows.org/api/v0/agent/transaction with your prompt, wallet address, and optional chainId, authenticated via the x-brian-api-key header. The response contains ordered calldata steps you sign and broadcast yourself with viem or ethers.

Does the Brian API execute transactions on my behalf?

No. Brian only returns transaction calldata from solvers like Enso and LI.FI. Your application must sign and broadcast each step in order, and Brian never holds private keys or submits transactions.

Which chains support DeFi deposit, withdraw, borrow, and repay actions?

DeFi actions via the Enso solver work only on Ethereum, Arbitrum, Optimism, Polygon, Base, and Avalanche. Other chains like BNB Chain, zkSync, and Scroll support only swap, bridge, and transfer.

Why does the Brian API return a 401 Unauthorized error?

A 401 means the API key header is missing or wrong. The header must be exactly x-brian-api-key, not Authorization: Bearer. Verify the key is set in your environment and regenerate it at brianknows.org if expired.

Why does Brian return an error saying it cannot determine the chain?

The prompt lacks a chain name and no chainId was passed, and the token exists on multiple chains. Fix it by including the chain in the prompt, such as "on Base", or by passing chainId like "8453" in the request body.

How do I build a LangChain agent that executes on-chain transactions?

Install @brian-ai/langchain and call createBrianAgent with your Brian API key, a private key, and an LLM such as ChatOpenAI with temperature 0. The agent interprets user input, fetches calldata from Brian, signs it, and broadcasts each step.