Claude Agent SDK
Give an agent built with the Claude Agent SDK the SpecStream tools. It searches the web, reads pages, and asks for live web data in plain words, on your SpecStream account, with paid runs approved in your own code.
SpecStream for Claude Agent SDKAgent frameworks & buildersWhat you need
- Python 3.10 or newer and the Claude Agent SDK.
- A SpecStream account. New accounts get $10 of credit on sign-up, no card.
- A SpecStream API key with a spending limit. The SDK runs no sign-in flow of its own, so the key goes in a header.
- 1
1. Install the SDK
Install the package. It brings the Claude Code CLI with it, so there is nothing else to install.
Terminal - 2
2. Create an API key
In your SpecStream workspace, open Agents & API, choose API keys, then Create API key. Give it only the projects, operations, and spending limit the agent needs.
Keep it in an environment variable where the agent runs:
Terminal - 3
3. Connect SpecStream
Add SpecStream to
mcp_serversinClaudeAgentOptionswith"type": "http", the addresshttps://api.specstream.ai/mcp, and the key as a Bearer header. Its tools take the namesmcp__specstream__<tool>, and a tool runs without a prompt only whenallowed_toolslists it.disallowed_toolstakes the built-inWebSearchandWebFetchout of Claude's toolset, so every search and page read goes through SpecStream. The agent can search, read, and price a request, and paid work waits for the last step.agent.py - 4
4. Ask for the data
Run the agent with a question for a quick answer, or with a request for many records that names the details to bring back on each one. For example:
Request - 5
5. Approve paid runs in your code
authorize_capacity_workis the one call that starts paid work, and it is left out ofallowed_toolson purpose. Pass acan_use_toolcallback toClaudeSDKClientand allow the call only whenconfirm_max_centsis within the limit you set. This example also refuses every other tool that is not on the list.approve.py
Check the connection
The first SystemMessage with subtype init lists each server in mcp_servers with its status. connected means the key works. needs-auth or failed means the key is missing or wrong, so check SPECSTREAM_API_KEY. A run goes on without a server that did not connect, so check the status before you trust the answer.
What the agent calls
The tools the agent uses most, in the order a request moves through them:
search_webanswers a question from the live web, at $5 per 1,000 searches of up to 10 results.read_pagesreturns the main text of up to 20 pages, at $0.80 per 1,000 pages. A page with no text is not charged.compilereads a request for many records back as editable parts, andquote_capacity_workprices it. Both cost nothing.authorize_capacity_workstarts the run with the approved maximum inconfirm_max_cents.get_findfollows progress, andlist_find_rowsreads the rows, with the source URL and read time on every value.
Cost
Searches and page reads come out of your balance with no quote. Each row of a run costs 5¢, 15¢ or $1, depending on how much the row needs, plus 5¢ for a person's email and 15¢ for a phone, and never more than the maximum you approved. A quote lasts 30 minutes, and a run that finds nothing costs nothing. How quotes and billing work
Spending limits
The key's own limits hold on every call: total, per run, monthly, and the operations it allows. A search over a limit stops with 402 or 403, and nothing is charged for it.
TypeScript
The TypeScript SDK, @anthropic-ai/claude-agent-sdk, takes the same server in mcpServers with type: "http", and the same tool names in allowedTools and disallowedTools. Its canUseTool option takes the approval callback.
Remove
Take the specstream entry out of mcp_servers and its names out of allowed_tools. To stop the key working everywhere, revoke it in Agents & API. Results already delivered stay in your workspace. Other ways to build with SpecStream are in agent frameworks, and the agent guide covers every tool. Questions go to [email protected].
More
SpecStream for Claude Agent SDK covers what it does in Claude Agent SDK on one page. Every other tool has its guide in Connect your tools. You see the most a request can cost before it starts, and the matches are paid from your balance. Billing has the details. For help, email [email protected].