brian-api

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @brian-ai/sdk, @brian-ai/langchain, viem, ethers, @langchain/openai, langchain, and includes references (resource) components.

What problem does it solve? Writing Web3 transactions by hand requires knowing contract addresses, ABI encoding, approval flows, and DEX/bridge routing across chains. This Skill lets you turn plain-English intents like "swap 10 USDC for ETH on Base" into ready-to-sign transaction calldata, avoiding stale protocol knowledge and hallucinated contract addresses. ## Core Features & Use Cases - Intent-to-Transaction: The /agent/transaction endpoint converts natural language prompts into ordered, executable transaction steps (approvals plus swaps, bridges, transfers, deposits, withdrawals, borrows, and repays) routed through solvers like Enso, LI.FI, and Bungee. - Knowledge and Contract Generation: The /agent/knowledge endpoint answers DeFi protocol questions with source citations, and /agent/smart-contracts generates Solidity code from descriptions. - Agent Integrations: The @brian-ai/langchain toolkit plugs Brian into LangChain agents, including Coinbase CDP wallet support, for autonomous on-chain agents. - Use Case: Build a backend that accepts a user's typed intent, fetches calldata from Brian, then signs and broadcasts each step with viem or ethers.js, executing a full Aave deposit-borrow-repay-withdraw cycle from conversational input. ## Quick Start Ask the agent to swap 10 USDC for ETH on Base using the Brian API with your BRIAN_API_KEY and wallet address, then sign and broadcast the returned transaction steps with viem.

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 transaction steps you sign and broadcast with viem or ethers.js.

Does the Brian API execute transactions on my behalf?

No, Brian only returns transaction calldata and never holds private keys or submits transactions. Your application must sign and broadcast each step in order, waiting for each receipt before executing the next step.

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

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 fail to determine the chain from my prompt?

Brian cannot guess the chain when a token exists on multiple networks. Include the chain name in the prompt, such as "swap USDC on Base", or pass the chainId field in the request body, which takes precedence.

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 conversational input, fetches calldata from Brian, signs it, and broadcasts the transactions.