
AgentBooks
Stop letting your agents overspend.
Demo
About
The problem it solves AI agents are being deployed by the thousands. Every single one is financially illiterate. Today, when developers run AI agent workflows — research pipelines, document processing, autonomous task completion — their agents default to using the same powerful (and expensive) model for every sub-task, regardless of complexity. Reading a webpage gets the same model as writing a legal memo. Formatting a CSV gets the same model as deep strategic reasoning. The result: Massive, preventable waste. A task that should cost $0.011 costs $0.034 — not because it needed that compute, but because no one taught the agent to think about money. What AgentBooks Lets You Do Cut AI inference costs by 60–70% automatically. AgentBooks decomposes any incoming task into atomic sub-tasks, scores each for cognitive complexity, and routes to the cheapest model capable of doing it well: Simple retrieval, scraping, formatting → Haiku (~19x cheaper than Opus) Summarization, writing, analysis → Sonnet Deep reasoning, legal review, novel judgment → Opus or decentralized compute At 10,000 tasks/day, that's ~$80,000/year saved — automatically, with no change to your agent's output quality. See exactly what your agents are spending, in real time. The AgentBooks dashboard gives operators a live P&L for every agent: cost per sub-task, cost per full task, and a running "counterfactual" showing what you would have spent without intelligent routing. Think Bloomberg terminal for AI cognitive spend. Enable trustless agent-to-agent commerce. When Agent A (Company X) needs to hire Agent B (Company Y) for a specialized sub-task, there's no safe way to do this today without a centralized billing intermediary holding API keys and taking rent. AgentBooks settles these payments on-chain via x402 micropayments — no platform in the middle, no shared credentials. Create immutable, auditable AI spend records. Every model call is logged on-chain with token counts, model used, and cost. For regulated industries (finance, legal, healthcare), this creates a tamper-proof audit trail that a SaaS database can't match — CFOs and compliance teams can verify AI spend independently, without trusting a vendor's dashboard. Who It's For Developers running multi-step agent pipelines who want to stop burning money on over-powered models for simple tasks Enterprise teams in regulated industries (legal, finance, healthcare) that need compliant, auditable AI cost records without sending sensitive data through third-party servers AI-native companies building agent marketplaces where agents transact with each other across organizational boundaries Use of AI tools and agents Claude (claude.ai + Project Knowledge) Our primary development environment. We created a Claude Project loaded with all technical reference documents, architecture specs, integration guides, and build plans. Every code module — FastAPI endpoints, smart contract logic, x402 payment flows, QuickNode webhook handlers — was written through structured Claude prompts with explicit context. Claude served as our entire engineering team, translating financial and product thinking into working code. Cursor Used as our AI-native code editor throughout the build. Cursor's inline AI assistance let us iterate on Python and JavaScript files rapidly, catching syntax errors and suggesting completions as we assembled the FastAPI backend and Next.js dashboard. Particularly useful for refactoring — when our webhook handler needed restructuring to support Server-Sent Events, Cursor helped us rewrite the module without breaking upstream dependencies. Warp Our AI-powered terminal. Warp's natural language command generation meant we could describe what we needed ("start the FastAPI server with hot reload on port 8000" or "check which process is holding this port") without memorizing CLI syntax. During deployment to OpenClaw, Warp's command history and AI-assisted debugging helped us move faster through environment setup and dependency issues. Oz Agent Cloud Used for agentic task execution — particularly for spinning up research and integration tasks in parallel while the core build was in progress. Oz Agent Cloud let us delegate investigative work (finding the correct 0G broker package methods, verifying Kite AI RPC endpoints, checking QuickNode Streams webhook format) to autonomous agents running in the background, keeping our build momentum without constant context-switching. OpenClaw (Deployment) Our backend server environment. All FastAPI code was deployed and run on OpenClaw rather than locally, which meant every integration (Claude API calls, x402 payment execution, QuickNode webhook receipt, SSE streaming) was live and publicly accessible throughout the build — giving us a real public URL for judge testing and eliminating "works on my machine" failure modes. Codex / OpenAI Used for secondary code generation tasks and cross-checking Claude outputs on specific integration patterns. When working through the 0G Labs broker SDK — which had limited documentation — we used Codex to explore the npm package structure and infer correct method signatures from type definitions. How the Tools Worked Together The workflow followed a consistent pattern throughout the 48 hours: Claude (Project Knowledge) produced the architectural spec and initial code for each module Cursor integrated that code into the live codebase with inline refinements Warp executed deployments, ran tests, and surfaced environment errors Oz Agent Cloud (via warp terminal) ran parallel research and integration investigation tasks OpenClaw kept everything live and accessible on a public URL throughout No single tool was sufficient alone, the value came from the handoff chain. Claude could generate correct logic but couldn't deploy it. Warp could run commands but needed correct code first. Oz Agent Cloud could find answers to integration questions but couldn't write the implementation. Together, they formed a coherent development pipeline that let a finance team ship a working full-stack AI product in two days. In a way, building AgentBooks with this AI stack is the proof of concept for the product itself: intelligent task decomposition, routing each piece of work to the right specialized tool, and aggregating the outputs into something that works. We didn't just build a system that teaches agents financial literacy, we ran one to build it.
How it's made
Challenges we ran into 1. 0G Labs Has No Traditional API Dashboard The biggest early blocker was discovering that 0G Labs operates nothing like a standard AI API provider. We assumed we'd sign up, grab an API key, and start routing requests — the same flow as OpenAI or Anthropic. Instead, 0G's decentralized compute network uses wallet-based authentication and an on-chain escrow ledger through their @0glabs/0g-serving-broker npm package. There's no dashboard. No API key. You fund a ledger account with broker.ledger.addLedger(), and the network authenticates you by your wallet signature. We had to completely rethink our integration approach mid-build, switching from a simple HTTP client pattern to a broker-mediated flow with on-chain settlement. Once we understood the architecture, it actually aligned perfectly with our vision — but the discovery cost us several hours of confused debugging. 2. QuickNode Streams → Webhook → Dashboard Pipeline Getting real-time cost data flowing from our on-chain AgentCostLedger contract to the dashboard was harder than expected. QuickNode Streams fires webhooks when it detects contract events — but our backend needed to receive those webhooks and immediately broadcast updates to connected frontend clients. The challenge: standard REST endpoints don't push. We had to implement Server-Sent Events (SSE) on our FastAPI backend so the dashboard could maintain a live connection and receive cost updates as each sub-task completed. Debugging the chain of contract event → QuickNode → webhook → SSE → browser meant failures could happen at any of five points, and each one looked identical from the frontend (just: nothing updated). We got through it by isolating each segment — confirming the contract was emitting events on-chain first, then verifying QuickNode was picking them up, then testing the webhook locally with ngrok before deploying. 3. Separating Hackathon Demo Scope from Production Architecture This wasn't a technical bug, but it was the most consequential challenge we hit. Midway through planning, we realized the architecture we were building for the demo — a hosted proxy where agent queries flow through our server — is structurally illegal for our target customers (hospitals, law firms, financial institutions) due to HIPAA, attorney-client privilege, and financial data regulations. We couldn't build the enterprise product in 48 hours, but we also couldn't pitch a demo that judges in regulated industries would immediately reject as non-viable. The solution was a deliberate dual-track strategy: build Scenario A (hosted proxy) for the demo to show real working functionality, while pitching Scenario B (SDK/metadata-only) as the production architecture. We scripted explicit responses for judge questions about data handling so the distinction was clear and credible rather than sounding like a pivot or a gap.