Build agents in minutes.
The Fibonacci AI Gateway and Agent SDK give you a typed, ergonomic interface to deploy, fund, and operate autonomous on-chain agents. Below is everything you need to ship.
Quickstart
Deploy your first agent in under three minutes. This example mints an ERC-φ identity, funds it from your wallet, and runs an Automation strategy on testnet.
# 1. install npm i @fibonacci/sdk @fibonacci/agents # 2. set your gateway key (get one at fibonacci.dev/keys) export FIB_API_KEY=fib_test_… # 3. deploy npx fib agent deploy --template automation --fund 144
That is it. The CLI scaffolds the agent, deploys the ERC-φ contract, escrows 144 FIB as the identity bond, registers it in the marketplace as private, and prints the agent address.
Installation
npm i @fibonacci/sdk # core client npm i @fibonacci/agents # agent runtime npm i @fibonacci/wallet # wallet + signing helpers npm i -D @fibonacci/cli # CLI + scaffolds
Rust (fibonacci-rs) and Python (fibonacci on PyPI) clients are available with feature parity for the SDK and Agent runtime.
Authentication
All HTTP endpoints authenticate via a bearer key in the Authorization header. Keys are scoped to a project and an environment (test or live).
POST /v1/agents/run Host: api.fibonacci.dev Authorization: Bearer fib_live_8f3c…d2a1 Content-Type: application/json
fib_live_* keys in client code. Use a server route to proxy calls and add per-user rate limiting.AI Gateway API
The AI Gateway is the unified endpoint for inference, embeddings, and verifiable model calls used by agents. It exposes an OpenAI-compatible surface plus Fibonacci-native extensions.
Endpoints
/v1/inference/v1/embeddings/v1/chat/completions/v1/modelsExample: inference with proof
import { Fibonacci } from "@fibonacci/sdk";
const fib = new Fibonacci({ apiKey: process.env.FIB_API_KEY });
const result = await fib.ai.inference({
model: "phi-mini-1b",
input: { prompt: "Summarize block 8,472,011 anomalies." },
proof: "zkml", // "none" | "zkml" | "tee"
maxTokens: 256,
});
console.log(result.output); // model output
console.log(result.proofId); // on-chain proof referenceResponse shape
{
"id": "inf_01HZP…",
"model": "phi-mini-1b",
"output": "Detected 3 outlier transactions…",
"tokens": { "input": 142, "output": 198 },
"cost": { "fib": 0.0021 },
"proofId": "0x9c2f…ae1",
"verified": true
}Agent SDK
The Agent SDK is a typed framework for building, deploying, and operating ERC-φ agents. Every agent extends the Agent base class and declares its capabilities, memory, and lifecycle hooks.
Minimal agent
import { Agent, capability } from "@fibonacci/agents";
import { z } from "zod";
export class YieldRouter extends Agent {
static manifest = {
name: "YieldRouter",
class: "DeFi",
version: "1.0.0",
bond: 144, // FIB
};
@capability({
schema: z.object({ amount: z.number().positive(), asset: z.string() }),
rateLimit: { perMinute: 60 },
})
async rebalance({ amount, asset }) {
const venues = await this.tools.markets.list({ asset });
const best = venues.sort((a, b) => b.apr - a.apr)[0];
return this.intent.swap({ from: asset, to: best.asset, amount });
}
}Lifecycle hooks
Memory
Encrypted long-term memory is exposed as a key/value store backed by ZK-DA. Reads are free; writes cost STATE_RENT per byte per block.
await this.memory.set("last_run", { ts: Date.now(), pnl: 1.42 });
const prev = await this.memory.get("last_run");Intents
Intents are declarative transaction requests. Solvers compete to execute them under the constraints you set; the protocol redistributes a share of any MEV captured back to you.
const id = await fib.intent.submit({
goal: "buy 100 FIB",
maxPrice: 0.42, // USDC
deadline: "+30s",
veto: "multisig(5-of-9)",
});
const status = await fib.intent.wait(id);
// → { state: "filled", price: 0.401, solver: "0x…", fee: 0.0006 }Verifiable Inference (zkML)
Anchor off-chain model decisions to on-chain proofs in roughly 38ms verification time. Required for any agent action with on-chain consequences derived from inference.
const { output, proofId } = await fib.ai.inference({
model: "risk-classifier-v3",
input: { txHash: "0xabc…" },
proof: "zkml",
});
// Submit on-chain action gated by the proof:
await contract.actIfVerified(proofId, output.score, { from: agentAddr });Wallet & Signing
The wallet package handles key generation, EIP-φ message signing, hardware wallets, and agent-delegated spending limits.
import { Wallet } from "@fibonacci/wallet";
const w = await Wallet.fromMnemonic(process.env.FIB_MNEMONIC);
// Grant an agent a bounded spending capability:
await w.delegate({
agent: "0xA17…b3",
scope: ["swap", "stake"],
limit: { dailyFIB: 500 },
expiry: "+7d",
});Marketplace API
/v1/marketplace/agents/v1/marketplace/agents/:id/v1/marketplace/agents/v1/marketplace/agents/:id/rentconst agents = await fib.marketplace.list({
class: "Trading",
minRep: 0.8,
maxPrice: 2, // FIB / call
limit: 20,
});JSON-RPC
Direct access to the Fibonacci node via standard EVM JSON-RPC, extended with fib_* methods.
POST https://rpc.fibonacci.dev
Content-Type: application/json
{ "jsonrpc": "2.0", "id": 1, "method": "fib_agentInfo",
"params": ["0xA17…b3"] }Rate Limits & Errors
Error shape
{
"error": {
"code": "rate_limited",
"status": 429,
"message": "Per-minute limit reached.",
"retryAfter": 12
}
}CLI
fib login # auth via gateway
fib agent new <name> # scaffold an agent
fib agent deploy # deploy + bond + register
fib agent logs --tail # stream logs
fib agent sim --block latest # local simulator
fib intent send '{…}' # submit an intent
fib rpc fib_phiBftFinalized # raw RPC call