# Strands Agents + Dizo

> Connect a Strands agent to the Dizo MCP server with MCPClient over streamable HTTP and let it search, enrich and verify B2B contacts.

Type: MCP client — server URL `https://mcp.dizo.ai/mcp`. No native app needed.

## Steps
1. `pip install strands-agents` and export `DIZO_API_KEY` in your shell.
2. Create an `MCPClient` with the Dizo URL and your key as an `Authorization` header.
3. Open the client with `with dizo:`, pass `dizo.list_tools_sync()` to `Agent(tools=...)` and call the agent inside the block.

## Where to go
`MCPClient` with the Streamable HTTP transport and an Authorization header.

Open the Strands MCP docs: https://strandsagents.com/docs/user-guide/sdk/tools/mcp-tools/#choose-a-transport

## agent.py
```
import os
from strands import Agent
from strands.tools.mcp import MCPClient

dizo = MCPClient(
    url="https://mcp.dizo.ai/mcp",
    headers={"Authorization": f"Bearer {os.environ['DIZO_API_KEY']}"},
)

with dizo:
    agent = Agent(
        tools=dizo.list_tools_sync(),
        system_prompt="Call dizo_whoami first. Quote with dizo_quote before any job over 100 credits.",
    )
    agent("Find the Head of Data at 10 US logistics companies with 200-1000 employees, with emails")
```

## Notes
- Tool calls must happen inside the `with dizo:` block; outside it the MCP session is closed.
- Use a `dz_test_` key while you build the agent: it returns synthetic data and never spends credits.
- If your installed Strands release does not accept `url=` on `MCPClient`, upgrade it or use the transport-callback form described in the Strands MCP docs.

## Related API docs
- [/docs/search](https://dizo.ai/docs/search.md)
- [/docs/best-match](https://dizo.ai/docs/best-match.md)
- [/docs/email-find](https://dizo.ai/docs/email-find.md)
- [/docs/me](https://dizo.ai/docs/me.md)


## Strands Agents and what Dizo adds to it

Strands Agents is an open-source SDK, with Python and TypeScript versions, that takes a model-driven approach to agents. You give an agent a model, a system prompt and a list of tools, and the model decides which tools to call and in what order. There is no graph to draw and no planner to configure. Strands has built-in support for the Model Context Protocol through its `MCPClient` class, which turns any MCP server into a set of tools the agent can call.

Dizo is a hosted MCP server at `https://mcp.dizo.ai/mcp` that speaks streamable HTTP. Point an `MCPClient` at it and your Strands agent gets the full Dizo tool set: plain-English search, structured people and company search, the decision-maker finder, org charts, email and phone finders, enrichment and reverse lookups, plus free tools for counting, quoting and checking budget. The agent can then answer questions like "who runs finance at these twenty accounts" with real, verified records instead of guesses.

## Why a model-driven agent needs a priced data source

In a model-driven loop, the model chooses its own next step. That is what makes Strands pleasant to build with, and it is also why the tools you hand it matter. A tool that silently costs money, or that returns plausible fiction, is dangerous when no human approves each call. Dizo was designed for exactly this caller. Every tool description includes its credit cost, so the model can reason about price as it plans. Lookups that find nothing are free, and searches charge only for the results they return.

Two free tools make the loop safer still. `dizo_whoami` reports the key's scopes, endpoint allow-list, remaining budget and rate limits, so the agent can plan within what it is allowed to do. `dizo_quote` returns the exact credit cost of any call and spends nothing. The [agent rules page](/agents) recommends quoting before any job that may exceed about 100 credits. Put that rule in the Strands `system_prompt` and the model will follow it as part of its normal reasoning.

## Jobs a Strands agent can do with Dizo

Because Strands leaves tool selection to the model, the most useful thing you can do is describe outcomes clearly. These are prompts and tasks that map cleanly onto Dizo tools:

- "How many VPs of Engineering are there at US healthtech companies with 50-500 employees?" The agent calls `dizo_count`, which is free.
- "Find the top finance contact at each of these 40 domains, CFO first, then VP Finance, then Controller." One `dizo_best_contact` call.
- "Who is behind this inbound signup email?" `dizo_email_to_profile`, charged only if found.
- "Map the marketing team at ledgerline.io." `dizo_org_chart` with a department filter.
- "Get a verified work email for each person on this list." `dizo_find_email` per person, or `dizo_batch` for more than 50.
- "These 300 addresses bounced. Find out who moved and get their new work email." `dizo_enrich_person` at 2 credits per match, then `dizo_find_email` at 1 credit if found.
- "Tell me when our champions change jobs." `dizo_watch_job_changes` with a webhook you host.

## Setting up the MCP client

Install the SDK with `pip install strands-agents` and export your key as `DIZO_API_KEY`. In your script, import `Agent` from `strands` and `MCPClient` from `strands.tools.mcp`. Create the client with two arguments: `url` set to the Dizo MCP endpoint, and `headers` containing `Authorization: Bearer` followed by the key read from the environment. When you pass a URL, Strands builds the streamable HTTP transport for you using the installed `mcp` package.

The client is a context manager. Open it with `with dizo:`, then call `dizo.list_tools_sync()` to fetch the tool list and pass it to `Agent(tools=...)`. Everything that calls a Dizo tool has to run inside that block, because the MCP session closes when the block exits. In practice that means you create the agent and invoke it inside the same `with` statement, as in the example on this page. If you build a long-running service, keep the block open for the life of the request handler rather than opening a new session for every question.

If you are on an older Strands release that does not accept `url=`, the Strands MCP documentation describes a callback form where you pass a function that opens the transport yourself. Check the version you have installed before mixing examples from different releases.

## A system prompt that controls spend

Strands agents follow their system prompt closely, so treat it as the place for spending policy. A short, specific prompt works better than a long list of warnings. Tell the agent to call `dizo_whoami` at the start of a session, to use `dizo_count` to size any search before running it, to call `dizo_quote` before anything likely to cost more than 100 credits, and to stop and ask when the remaining monthly budget is low.

Then make the limits real on the key itself, because a prompt expresses a preference and the key enforces it. In the console, create a dedicated key for the agent with the `data:read` scope, a `max_credits_per_request`, daily and monthly credit caps, and an endpoint allow-list containing only the tools the agent needs. MCP connections already default to `data:read` and a 500-credit per-call limit unless you change them. The [keys reference](/docs/keys) lists every field, and the account-level monthly cap is covered under [spend limits](/docs/billing-limits).

## What a run costs

Take the example prompt on this page: find the Head of Data at 10 US logistics companies and get their emails. Assume the agent first counts the segment (free), then uses the decision-maker finder across 10 company domains. That returns at most 10 people, and the finder charges 1 credit per 25 people returned, so 10 people cost 0.4 credits. If the agent then finds emails and 8 of the 10 are found, that is 8 credits, with the 2 misses free. The whole run is 8.4 credits, or about $0.21 at the $0.025 pay-as-you-go rate.

Phones change the picture. Phone finder is 10 credits per number found, so adding mobiles for those 8 people could add up to 80 credits, about $2.00 at the same rate. That is why a good prompt tells the agent to fetch phones only when asked. Credit prices drop with purchase size, down to $0.010 per credit at the top tier, and the [pricing page](/pricing) has the full table.

## Two end-to-end workflows

**Account research on demand.** A sales engineer asks the agent about a target account before a call. The agent calls `dizo_domain_to_company` for the firmographic profile, `dizo_org_chart` filtered to the relevant department, and `dizo_find_email` for the two or three people the engineer picks. Company lookup is 1 credit if found, the org chart is 1 credit per 25 people returned, and each email found is 1 credit. A typical briefing stays under 10 credits.

**Weekly list refresh.** A scheduled job runs a Strands agent with a narrow prompt: build a list of new heads of RevOps at Series B software companies, skip anyone on the suppression list, add work emails and write the results to a file. The agent uses `dizo_create_list` for the list and suppression dedupe, and adds an email column, which only charges for addresses that validate. Put a `max_credits` value in the prompt and on the key, and the job cannot exceed it even if the segment turns out larger than expected. For a recurring version of the same search, a Dizo [monitor](/docs/monitors) charges only for new matches.

## Troubleshooting

If the agent says it has no Dizo tools, the usual cause is calling the agent outside the `with dizo:` block, or building the agent before `list_tools_sync()` ran. A `401` from the server means the header is missing or the key is wrong; print the first few characters of the environment variable to check it is set in the process that runs the agent. If a tool you expect is missing, the key's endpoint allow-list may exclude it.

A `402` response means a budget limit was reached: the key's cap, the account's monthly cap, or an empty balance. The error includes a plain-English `fix`. Rate limit errors include `error.retryable` and `error.retry_after`, so instruct the agent to wait that long before retrying rather than looping immediately. When retrying POST requests outside MCP, send an `Idempotency-Key` header so a retry within 24 hours is never charged twice.

## Security practices

Keep the key in an environment variable or your secrets manager, never in the source file or the system prompt. Use a `dz_test_` key while you develop: it returns synthetic data and never spends credits, which lets you test prompts and tool selection freely. Give each agent or deployment its own key so you can see usage per agent and revoke one without touching the others.

Billing write actions such as top-ups and refill changes require the `billing:write` scope, which agent keys should not have. If a person needs to approve a purchase, they can do it in the console. [Sign up](/signup) to get a live key.

## FAQ

### Which package do I install for Strands and Dizo?
Install `strands-agents`. The `MCPClient` class lives in `strands.tools.mcp`, and Dizo needs no package of its own because it is a hosted MCP server. You only supply the URL and an `Authorization` header.

### Why do my Dizo tool calls fail after the with block?
The MCP session is tied to the `with dizo:` context manager. Once the block exits, the connection is closed and tool calls fail. Create and invoke the agent inside the block, or keep the block open for the lifetime of your service.

### Can a Strands agent overspend my account?
Only up to the limits you set. Each key can have a per-request cap, a daily cap and a monthly cap, and the account has its own monthly cap. MCP connections default to a 500-credit per-call limit, and calls stop with a 402 when a cap is reached.

### Does the agent pay when Dizo finds nothing?
No. Email, phone and profile lookups are charged only when they return a result, and searches charge only for results returned. Company enrich follows the same rule: 1 credit, only when the domain matches.

### Can I test the agent without spending credits?
Yes. Keys that start with `dz_test_` return synthetic data and never spend credits. Use one while you tune the system prompt, then switch to a live key with caps when you deploy.

### Does this work with the TypeScript version of Strands?
The Strands docs show MCP clients in TypeScript as well, passed directly in the agent's tools array. The Dizo side is the same: the MCP URL and a bearer header. Check the Strands TypeScript docs for the exact client constructor in your version.
