# Agno + Dizo

> Connect an Agno agent to the Dizo MCP server with MCPTools over streamable HTTP, auth headers and an include_tools filter.

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

## Steps
1. `pip install "agno[mcp]" anthropic` and export `DIZO_API_KEY`.
2. Build `StreamableHTTPClientParams` with the Dizo URL and an `Authorization` header.
3. Open `MCPTools(server_params=..., transport="streamable-http")` with `async with` and pass it to `Agent(tools=[...])`.
4. Use `include_tools` to expose only the Dizo tools this agent needs.

## Where to go
`MCPTools` with `transport="streamable-http"` and headers.

Open the Agno MCP docs: https://docs.agno.com/tools/mcp/transports/streamable_http

## agent.py
```
import asyncio, os
from agno.agent import Agent
from agno.models.anthropic import Claude
from agno.tools.mcp import MCPTools, StreamableHTTPClientParams

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

async def main():
    async with MCPTools(
        server_params=params,
        transport="streamable-http",
        include_tools=["dizo_watch_job_changes", "dizo_find_email", "dizo_balance", "dizo_quote"],
    ) as dizo:
        agent = Agent(
            model=Claude(id="claude-sonnet-5-5"),
            tools=[dizo],
            instructions="Check dizo_balance before large jobs. Stop on a 402.",
        )
        await agent.aprint_response("Find the new work email for Maya Okafor, who just left ledgerline.io.", stream=True)

asyncio.run(main())
```

## Notes
- For a long-running agent process, set `refresh_connection=True` so Agno re-checks the connection and tool list before each run.
- If you also connect other MCP servers, `tool_name_prefix` avoids name collisions.

## Related API docs
- [/docs/signals](https://dizo.ai/docs/signals.md)
- [/docs/email-find](https://dizo.ai/docs/email-find.md)
- [/docs/billing](https://dizo.ai/docs/billing.md)


## Agno in brief, and why it pairs well with Dizo

Agno is an open-source Python framework for building agents. You create an `Agent` with a model, a list of tools and instructions, and run it with methods such as `aprint_response` for streamed output in development. Agno ships model classes for several providers, including Anthropic's Claude and OpenAI, and its MCP support lives in `agno.tools.mcp` as the `MCPTools` class.

`MCPTools` can connect to a remote server over streamable HTTP, either with just a `url` and `transport="streamable-http"`, or with a `StreamableHTTPClientParams` object that carries headers and timeouts. That second form is what Dizo needs, because the hosted server at `https://mcp.dizo.ai/mcp` authenticates with an `Authorization: Bearer` header. Once connected, every Dizo tool, from plain-English search to email and phone finders, becomes a tool your Agno agent can call.

## Why connect an Agno agent to Dizo

Agno is often used for agents that run as services: a process that wakes on a schedule or a webhook, does a piece of work and reports back. Those agents need facts that stay current. Dizo's job-change signals, monitors and verified lookups give a service-style agent a way to notice when something changed and then act on it with fresh contact data rather than whatever was in the CRM last quarter.

The economics also suit unattended work. Each Dizo tool description includes its credit cost. Lookups that find nothing are free, searches charge only for results returned, and `dizo_quote` returns the exact cost of a call without spending anything. Combined with per-key caps, that means an agent you are not watching has a known ceiling. The [MCP server page](/mcp) lists every tool and its price.

## Tasks to hand an Agno agent

Prompts and jobs that map onto Dizo tools:

- "Watch these 2,000 customer champions and tell me when one changes jobs" with `dizo_watch_job_changes`.
- "Maya Okafor just left ledgerline.io. Find her new work email" with `dizo_find_email`.
- "Every morning, give me new VPs of Sales at fintechs in Texas" with `dizo_create_monitor`.
- "Who else is on the finance team at her new company?" with `dizo_org_chart`.
- "This contact bounced; who is the right person now and what is their current email?" with `dizo_enrich_person` and `dizo_find_email`.
- "How much have we spent this month?" with `dizo_balance`, which is free.

## Setting up MCPTools step by step

Agno's docs install MCP support with `uv pip install "agno[mcp]" anthropic openai`; with pip, `pip install "agno[mcp]" anthropic` is enough if you use Claude. Export `DIZO_API_KEY`. Start with a `dz_test_` key, which returns synthetic data and never spends credits, so you can shape the agent's behaviour before it touches a live balance.

Build the connection object: `StreamableHTTPClientParams(url="https://mcp.dizo.ai/mcp", headers={"Authorization": f"Bearer {key}"}, timeout=30)`. The same object accepts `sse_read_timeout` and `terminate_on_close` if you need to tune long streams. Then open the tools with `async with MCPTools(server_params=params, transport="streamable-http") as dizo:`. The context manager opens the connection and closes it when the block exits.

Inside the block, create `Agent(model=Claude(id="claude-sonnet-5-5"), tools=[dizo], instructions=...)` and call `await agent.aprint_response(prompt, stream=True)` while developing. In a service you would call the non-printing run method and handle the result in code.

## Filtering, prefixes and long-running connections

`MCPTools` takes `include_tools` and `exclude_tools` to select which discovered tools the agent sees. Use `include_tools` with Dizo. A champion-tracking agent might need only `dizo_watch_job_changes`, `dizo_find_email`, `dizo_balance` and `dizo_quote`. A shorter list keeps the model focused and prevents it from reaching for a phone lookup at 10 credits when an email at 1 credit would do.

If the agent also connects to other MCP servers, set `tool_name_prefix` to avoid collisions between tool names. For an agent that stays up for hours or days, Agno's `refresh_connection=True` checks the connection before each run, re-establishes it if needed and refreshes the tool list. That is useful for any hosted server, since it means a restart on either side does not leave the agent holding a dead session.

## Controlling spend

Put the rules in the agent's `instructions`: check `dizo_balance` before large jobs, call `dizo_quote` for anything that may exceed about 100 credits, and stop on a 402. Then enforce limits on the key itself, because instructions are guidance to a model and the key is a hard boundary.

Create a dedicated key with `data:read` scope, a `max_credits_per_request`, a daily cap, a monthly cap and an endpoint allow-list that mirrors your `include_tools` list. MCP connections default to `data:read` and a 500-credit per-call limit unless changed in the console. The account's monthly spend cap stops every call with `402 monthly_cap_reached`, and alerts at 50%, 80% and 100% of a cap go to email and webhook. Setting these is covered in the [keys docs](/docs/keys).

## Worked example: a monthly champion-tracking service

A customer success team asks Agno to watch 2,000 champions. The agent calls `dizo_watch_job_changes` once. Job-change signals cost 1 credit per change detected, so watching costs nothing until someone moves. Assume 60 changes are detected in a month: 60 credits.

For each change, the agent finds the person's new work email. Assume 50 of 60 are found; misses are free, so that is 50 credits. For the ten accounts the team cares most about, it also finds a mobile number at 10 credits each, assuming all ten are found: 100 credits. The month totals 210 credits.

At the $0.025 pay-as-you-go rate that is $5.25. If the team buys $500 to $1,999 of credits at a time, at $0.021, it is $4.41. The phone step is the biggest line item, which is why the instructions should reserve it for named accounts. The [champion tracking use case](/use-cases/champion-tracking) covers the play in more depth, and current tiers are on [pricing](/pricing).

## Second example: a daily monitor for new executives

A founder wants a morning list of newly appointed VPs of Sales at fintech companies in Texas. Rather than searching from scratch each day, the agent calls `dizo_create_monitor` once with that query, `schedule` set to daily, a `webhook_url` and `max_credits_per_run` set to 100. Monitors charge 1 credit per 25 new results, so the agent only pays for people who started matching since the last run.

Assume around 15 new matches a day, or 450 in a month: 18 credits. When a webhook arrives, the Agno service picks the most relevant people and calls `dizo_find_email` for them. If it looks up 100 people over the month and 85 emails are found, that step is 85 credits, because the 15 misses are free. The month totals 103 credits, about $2.58 at $0.025.

The `max_credits_per_run` ceiling matters here. If a broad query suddenly matches far more people than expected, a single run cannot spend more than the limit you set, and the per-key daily cap backs that up. Agno's job is to decide what to do with each new person; Dizo's job is to make sure the spend behind that decision stays bounded. The [monitors reference](/docs/monitors) lists every parameter.

## Troubleshooting

Issues you may see when connecting Agno to Dizo:

- Auth errors on connect: the header is missing the `Bearer ` prefix, or `DIZO_API_KEY` is not set in the process environment.
- Tools not visible: check `include_tools` names against the Dizo tool list, then the key's endpoint allow-list.
- Connection drops in a long-running service: set `refresh_connection=True` so Agno reconnects before each run.
- Slow responses timing out: raise `timeout` and `sse_read_timeout`, or move large jobs to `dizo_batch`.
- 402 `monthly_cap_reached`: stop and alert a human; do not retry in a loop.
- Rate limits: retry only when `error.retryable` is true, after `error.retry_after` seconds.

## Security practices

Read the key from the environment or a secrets manager and never log the headers object. Give each agent service its own key so `dizo_balance` shows its usage separately and you can revoke one service without affecting others. Agent keys should not hold `billing:write`; only that scope can top up or change refills, and the account owner can lock billing entirely.

Keep `dz_test_` keys in development and CI, and use live keys only in production. [Sign up](/signup) to get one. Work email signups get 250 free credits and no card is required.

## FAQ

### How does Agno connect to the Dizo MCP server?
With `MCPTools` from `agno.tools.mcp`, using `transport="streamable-http"` and a `StreamableHTTPClientParams` object that holds the Dizo URL and an `Authorization: Bearer` header. Open it with `async with` and pass it to your agent's tools.

### Can I limit which Dizo tools the agent sees?
Yes. Pass `include_tools` with the tool names you want, or `exclude_tools` to drop some. Mirror that list in the key's endpoint allow-list so the limit is also enforced on Dizo's side.

### What does refresh_connection do?
When set to `True`, Agno checks the MCP connection before each run, reconnects if needed and refreshes the tool list. It is useful for agents that run as long-lived services.

### Does watching contacts for job changes cost anything up front?
No. Job-change signals cost 1 credit per change detected, so you pay only when someone actually moves. Follow-up lookups such as a new email are charged at their own rates, only if found.

### How do I test without a live balance?
Use a `dz_test_` key. It returns synthetic data and never spends credits, so you can run the full agent loop in development.

### Is there a Dizo toolkit built into Agno?
No. There is no native Dizo toolkit or listing. You connect through Agno's standard `MCPTools` support for remote MCP servers.
