> SpecStream is the live web data engine for teams and agents. This is the Markdown copy of https://specstream.ai/docs/integrations/inngest-agentkit. Every page, with what SpecStream does and costs: https://specstream.ai/llms.txt

# Inngest AgentKit

Give an AgentKit agent SpecStream's tools over Streamable HTTP. It can search the live web, read pages and build datasets of structured rows, and inside an Inngest function each tool call runs as its own step.

[SpecStream for Inngest AgentKitAgent frameworks & builders](https://specstream.ai/integrations/inngest-agentkit.md)

## What you need

-   Node.js, `@inngest/agent-kit` (this guide follows 0.13.2) and its peers `inngest` and `zod`.
-   A SpecStream API key with a spending limit. New accounts get $10 of credit on sign-up, no card.

1.  1

    ## 1. Create an API key

    In your SpecStream workspace, open [Agents & API](https://specstream.ai/workspace/agents?tab=keys&utm_source=agentkit), choose **API keys**, then **Create API key**. Give it only the spending limit the agent needs, and keep it in an environment variable where the agent runs:

    Terminal

    ```bash
    npm install @inngest/agent-kit inngest zod
    export SPECSTREAM_API_KEY="YOUR_SPECSTREAM_API_KEY"
    ```

2.  2

    ## 2. Add SpecStream to the agent

    Put SpecStream in the agent's `mcpServers` with the `streamable-http` transport. AgentKit passes `requestInit` to the MCP SDK's `StreamableHTTPClientTransport`, so the key goes as a header on every request:

    research.ts

    ```typescript
    import { anthropic, createAgent, createNetwork } from "@inngest/agent-kit";
    
    const researcher = createAgent({
      name: "researcher",
      description: "Answers questions from the live web.",
      system: "Use the SpecStream tools to search the web and read pages. Give the source URL for each fact.",
      mcpServers: [
        {
          name: "specstream",
          transport: {
            type: "streamable-http",
            url: "https://api.specstream.ai/mcp",
            requestInit: {
              headers: { Authorization: `Bearer ${process.env.SPECSTREAM_API_KEY}` },
            },
          },
        },
      ],
    });
    
    export const research = createNetwork({
      name: "research",
      agents: [researcher],
      defaultModel: anthropic({
        model: "claude-sonnet-4-5",
        defaultParameters: { max_tokens: 4096 },
      }),
      maxIter: 6,
    });
    ```

3.  3

    ## 3. Run the network

    On its first run the agent lists the server's tools and names each one after the server: `specstream-search_web`, `specstream-read_pages` and the rest. The model picks them like any tool you made with `createTool`.

    run.ts

    ```typescript
    import { research } from "./research";
    
    const run = await research.run("Which Postgres extensions for vector search shipped a release this month?");
    console.log(run.state.results.at(-1)?.output);
    ```

4.  4

    ## 4. Run it inside an Inngest function

    Serve the network from an Inngest function as you would any AgentKit network. There AgentKit wraps each MCP call in `step.run`, named after the tool, so a retry of the function reuses a search that already returned and does not pay for it twice.

## What the agent can call

AgentKit adds every tool the server lists. These are the ones a research agent uses most:

-   `specstream-search_web` answers a question from the live web, with the results it read and a source URL and read time on each value.
-   `specstream-read_pages` returns the main text of up to 20 web pages or documents (PDF, Word, Excel) in one call.
-   `specstream-compile` reads a request for a dataset into conditions and columns, and `specstream-quote_capacity_work` prices it. Neither spends anything.
-   `specstream-authorize_capacity_work` starts the run, only with the approved maximum in `confirm_max_cents`. `specstream-get_find` and `specstream-list_find_rows` follow it and read the rows.

## Spending limits

Searches and page reads are charged per call with no approval. A dataset run needs a quote, and starts only with that quote's maximum. The key's own spending limit holds over both: a call past it is refused with `403`. In a network that should not start paid runs on its own, give the key a low limit, or route to a person before `authorize_capacity_work`.

## OAuth for your users

When each user of your app should spend from their own SpecStream account, pass an MCP SDK `OAuthClientProvider` as `authProvider` in the same transport, in place of the header. AgentKit hands it to the transport unchanged.

## One search tool without MCP

To give an agent a single search tool with no MCP connection, call the Search API from a `createTool` handler: `GET https://api.specstream.ai/v1/web-search?q=` with `Authorization: Bearer` and your key. The [Search API docs](https://specstream.ai/docs/search-api.md) list the reply's fields.

## Cost

Connecting is free. Each search is one Search API call at $5 per 1,000 searches of up to 10 results, and each page read with text is $0.80 per 1,000 pages. A dataset costs 5¢, 15¢ or $1 a row, plus 5¢ for a person's email and 15¢ for a phone, never more than the approved maximum, and a run that finds nothing costs nothing. [How quotes and billing work](https://specstream.ai/docs/billing.md).

## Remove

Take the `specstream` entry out of `mcpServers`. Revoke the key under **Agents & API** to stop it everywhere. Results already delivered stay in your workspace. Other ways to build with SpecStream are in [agent frameworks](https://specstream.ai/docs/frameworks.md). Questions go to [support@specstream.ai](mailto:support@specstream.ai).

## More

[SpecStream for Inngest AgentKit](https://specstream.ai/integrations/inngest-agentkit.md) covers what it does in Inngest AgentKit on one page. Every other tool has its guide in [Connect your tools](https://specstream.ai/docs/integrations.md). You see the most a request can cost before it starts, and the matches are paid from your balance. [Billing](https://specstream.ai/docs/billing.md) has the details. For help, email [support@specstream.ai](mailto:support@specstream.ai).
