{
  "$schema": "https://agentsjson.org/schema.json",
  "version": "0.1.0",
  "info": {
    "title": "AskBeans",
    "description": "A hosted agent harness: deep research as an API. One POST kicks off a swarm that plans, browses, reads sources, and cross-checks, then returns a cited report; poll or stream for the result. No framework, model, or scraping stack to choose. Self-serve onboarding with no browser and no human — starter credits land automatically on signup, and an agent can buy more itself over the x402 protocol (USDC on Base).",
    "version": "1.0.0",
    "homepage": "https://askbeans.io"
  },
  "sources": [
    {
      "type": "openapi",
      "url": "https://askbeans.io/api/v1/openapi.json"
    },
    {
      "type": "llms.txt",
      "url": "https://askbeans.io/llms.txt"
    }
  ],
  "auth": {
    "type": "bearer",
    "instructions": "Two ways in. (a) PAY PER RUN, no account: POST https://askbeans.io/api/v1/x402/run/<mode> with a JSON body {\"input\": \"…\"} and no payment header; the 402 carries the requirements; sign the EIP-3009 authorization and POST again with X-PAYMENT or PAYMENT-SIGNATURE; the 202 carries the run id, a poll URL, and — because the paying wallet becomes the account — an sk_swarm_ key shown once. GET https://askbeans.io/api/v1/x402/run lists modes and prices. (b) MINT A KEY, no human: 1) GET https://askbeans.io/api/v1/auth/config for the Supabase url + anon key. 2) POST {supabase_url}/auth/v1/signup (header apikey: {anon_key}) with a fresh email/password — email confirmation is off, the access_token works immediately. 3) POST https://askbeans.io/api/v1/agent/register with that token (stamps your agent id; idempotent). 4) POST https://askbeans.io/api/v1/account/api-keys {\"name\":\"my-agent\"} — store the returned sk_swarm_ key, it is shown once. 5) Send it as Authorization: Bearer sk_swarm_… on every call. Out of credits? POST https://askbeans.io/api/v1/x402/topup?usd=5 with your bearer and no payment header; the 402 carries the payment requirements (v1 in the body, v2 in the PAYMENT-REQUIRED header). Sign the EIP-3009 authorization and repeat the request with X-PAYMENT or PAYMENT-SIGNATURE set."
  },
  "flows": [
    {
      "id": "pulse",
      "description": "Free, no credentials: live prices (BTC, ETH, SOL, AMZN, NVDA) and today's news stories. Try this before onboarding.",
      "actions": [
        {
          "id": "getPulse",
          "description": "GET https://askbeans.io/api/v1/pulse — prices with the session's change, the newest published news digest parsed into stories with source links, and the market wire's latest headlines. Also the MCP tool market.pulse. Never charged."
        }
      ]
    },
    {
      "id": "payPerRun",
      "description": "Pay for one run with USDC over x402 and start it, with no account beforehand. The wallet becomes the account; a key comes back once.",
      "actions": [
        {
          "id": "listRunResources",
          "description": "GET https://askbeans.io/api/v1/x402/run — every mode with its price in USD. Free."
        },
        {
          "id": "quoteRun",
          "description": "POST https://askbeans.io/api/v1/x402/run/{mode} with {\"input\": \"…\"} and no payment header → 402 with PaymentRequirements (v1 body, v2 PAYMENT-REQUIRED header)."
        },
        {
          "id": "payAndLaunch",
          "description": "Sign the EIP-3009 authorization and repeat the POST with X-PAYMENT (v1) or PAYMENT-SIGNATURE (v2) → 202 {run_id, poll_url, report_url, credentials.authorization}. Store the key."
        },
        {
          "id": "waitAndRead",
          "description": "GET poll_url with the Authorization header until status is completed (3–10 minutes), then GET report_url. Over MCP: runs.wait, then runs.report."
        }
      ]
    },
    {
      "id": "payPerCall",
      "description": "Two cents, no account: web search, a model completion, live quotes, or a public page as text — the answer arrives in the paid response.",
      "actions": [
        {
          "id": "search",
          "description": "GET|POST https://askbeans.io/api/v1/search {\"query\": \"…\"} — 25 free searches a day per caller (≤5 results; the response carries free_remaining_today). Over the quota: 402, sign, POST again with the payment header → {query, elapsed_ms, providers_used, results:[{url, title, snippet, published}]} (≈ $0.02, ≤20 results, no daily cap). No account."
        },
        {
          "id": "searchReport",
          "description": "POST https://askbeans.io/api/v1/search/report {\"query\": \"…\"} — one call: live web search synthesized into a cited bullet brief (every finding ends with its source URL), results included. Pay-only (≈ $0.05): 402, sign, POST again with the payment header → {query, report, results, usage, paid}. No account."
        },
        {
          "id": "newsBrief",
          "description": "POST https://askbeans.io/api/v1/news/brief {} — no input: today's market-news brief in one call, the platform's newest published news digest synthesized with the live market wire into a cited bullet brief. Pay-only (≈ $0.05): 402, sign, POST again with the payment header → {as_of, brief, digest, headlines, usage, paid}. The same raw data free: GET /api/v1/pulse. No account."
        },
        {
          "id": "quote",
          "description": "POST https://askbeans.io/api/v1/x402/quote {\"symbols\": [\"NVDA\",\"BTC-USD\"]} — 402, sign, POST again → {results:[{symbol, price, change_pct, …}]} (≈ $0.01)."
        },
        {
          "id": "fetch",
          "description": "POST https://askbeans.io/api/v1/x402/fetch {\"url\": \"https://…\", \"extract\": \"text|links|metadata\"} — 402, sign, POST again → {status, final_url, text, blocked} (≈ $0.02). Public hosts only."
        },
        {
          "id": "chat",
          "description": "POST https://askbeans.io/api/v1/x402/chat {\"messages\": [{\"role\": \"user\", \"content\": \"…\"}], \"max_tokens\": 512} — 402, sign, POST again → {content, model, finish_reason, usage} (≈ $0.02). One completion on the engine the swarm runs; 24 messages in, 1024 tokens out. With an account, the OpenAI-compatible endpoint is /api/v1/llm/v1/chat/completions, metered on credits."
        }
      ]
    },
    {
      "id": "onboard",
      "description": "Zero to authenticated API client, no browser and no human. Starter credits land automatically on the first authenticated call.",
      "actions": [
        {
          "id": "getAuthConfig",
          "description": "Discover the auth backend (public, no credentials)."
        },
        {
          "id": "supabaseSignup",
          "description": "Create the account directly against Supabase Auth ({supabase_url}/auth/v1/signup). Returns an access_token immediately."
        },
        {
          "id": "registerAgent",
          "description": "Stamp the account as an agent (POST /api/v1/agent/register). Idempotent — safe to call on every boot."
        },
        {
          "id": "mintApiKey",
          "description": "Mint a long-lived sk_swarm_ key (POST /api/v1/account/api-keys). Store it — shown once."
        }
      ]
    },
    {
      "id": "research",
      "description": "Ask a question, get a cited report. Optionally route first to pick the right mode.",
      "actions": [
        {
          "id": "routePrompt",
          "description": "POST /api/v1/route — classify a freeform prompt into the right mode. Never charged."
        },
        {
          "id": "launchRun",
          "description": "POST /api/v1/runs with {mode, input}. Returns the run record incl. its id. Billed from your credits."
        },
        {
          "id": "pollRun",
          "description": "GET /api/v1/runs/{id} until status is completed (or stream GET /api/v1/runs/{id}/events as SSE)."
        },
        {
          "id": "getReport",
          "description": "GET /api/v1/runs/{id}/report — the finished, cited report."
        }
      ]
    },
    {
      "id": "topup",
      "description": "Refill credits when the starter grant runs out — machine-payable, no browser.",
      "actions": [
        {
          "id": "getCryptoTerms",
          "description": "GET /api/v1/billing/crypto — receiving address, network (Base), asset (USDC), rate, minimum."
        },
        {
          "id": "sendUsdc",
          "description": "Transfer USDC on Base to the pay_to address from any wallet you control."
        },
        {
          "id": "claimTopup",
          "description": "POST /api/v1/billing/crypto-topup {tx_hash} with your bearer — the transfer is verified on-chain and credits land. Idempotent per tx hash."
        }
      ]
    }
  ]
}
