# How to integrate Altoviz MCP with Pydantic AI

```json
{
  "title": "How to integrate Altoviz MCP with Pydantic AI",
  "toolkit": "Altoviz",
  "toolkit_slug": "altoviz",
  "framework": "Pydantic AI",
  "framework_slug": "pydantic-ai",
  "url": "https://composio.dev/toolkits/altoviz/framework/pydantic-ai",
  "markdown_url": "https://composio.dev/toolkits/altoviz/framework/pydantic-ai.md",
  "updated_at": "2026-10-05T05:34:39.360Z"
}
```

## Introduction

This guide walks you through connecting Altoviz to Pydantic AI using the Composio tool router. By the end, you'll have a working Altoviz agent that can find customer details by email address, update a client's company information, retrieve current vat rates for invoices through natural language commands.
This guide will help you understand how to give your Pydantic AI agent real control over a Altoviz account through Composio's Altoviz MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate Altoviz with

- [Claude Code](https://composio.dev/toolkits/altoviz/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/altoviz/framework/claude-cowork)
- [OpenAI Agents SDK](https://composio.dev/toolkits/altoviz/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/altoviz/framework/claude-agents-sdk)
- [Codex](https://composio.dev/toolkits/altoviz/framework/codex)
- [OpenClaw](https://composio.dev/toolkits/altoviz/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/altoviz/framework/hermes-agent)
- [Atomic Agent](https://composio.dev/toolkits/altoviz/framework/atomic-agent)
- [Google ADK](https://composio.dev/toolkits/altoviz/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/altoviz/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/altoviz/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/altoviz/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/altoviz/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/altoviz/framework/crew-ai)
- [AutoGen](https://composio.dev/toolkits/altoviz/framework/autogen)

## TL;DR

Here's what you'll learn:
- How to set up your Composio API key and User ID
- How to create a Composio Tool Router session for Altoviz
- How to attach an MCP Server to a Pydantic AI agent
- How to stream responses and maintain chat history
- How to build a simple REPL-style chat interface to test your Altoviz workflows

## What is Pydantic AI?

Pydantic AI is a Python framework for building AI agents with strong typing and validation. It leverages Pydantic's data validation capabilities to create robust, type-safe AI applications.
Key features include:
- Type Safety: Built on Pydantic for automatic data validation
- MCP Support: Native support for Model Context Protocol servers
- Streaming: Built-in support for streaming responses
- Async First: Designed for async/await patterns

## What is the Altoviz MCP server, and what's possible with it?

The Altoviz MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Altoviz account. It provides structured and secure access to your customers, contacts, products, invoices, credit notes, receipts, and quotes, so your agent can create invoices, find customer records, organize products, record payments, and download billing documents on your behalf.
- Customer and contact management: Have your agent create and find customers or contacts, retrieve customer contacts, organize customers into families, and remove customer records.
- Invoice and credit note handling: Let the agent create draft sales invoices and credit notes, find existing records, download PDF copies, or delete drafts you no longer need.
- Product catalog organization: Direct your agent to create, find, retrieve, or delete products and organize them into product families.
- Payment receipt tracking: Instruct your agent to create receipts for customer payments, find existing receipts, retrieve their details, or delete them.
- Quote and document retrieval: Have your agent find sales quotes, remove quotes when needed, and download available purchase invoices as PDF files.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `ALTOVIZ_CREATE_CONTACT` | Create Contact | Creates a new contact in the Altoviz system. Use when you need to add a new contact with details like name, email, phone, and company information. |
| `ALTOVIZ_CREATE_CUSTOMER` | Create Customer | Creates a new customer in Altoviz. Use type='Company' for business customers (requires companyName) or type='Individual' for personal customers (typically uses firstName/lastName). |
| `ALTOVIZ_CREATE_CUSTOMER_FAMILY` | Create Customer Family | Creates a new customer family in Altoviz for categorizing and organizing customers into groups. Use when you need to create customer segments or categories for better organization. |
| `ALTOVIZ_CREATE_PRODUCT` | Create Product | Creates a new product in the Altoviz system. This tool allows for the independent creation of a product with all necessary details. |
| `ALTOVIZ_CREATE_PRODUCT_FAMILY` | Create Product Family | Tool to create a new product family in Altoviz. Use when you need to organize products into categories or families for better inventory management. |
| `ALTOVIZ_CREATE_RECEIPT` | Create Receipt | Creates a new receipt in the Altoviz system to record customer payments. Use when you need to document received payments and optionally link them to invoices or other documents. |
| `ALTOVIZ_CREATE_SALE_CREDIT` | Create Sale Credit | Creates a new draft credit note (avoir) in Altoviz. Credit notes are used to cancel or refund invoices. The credit note is created in draft status and can be modified before being finalized. |
| `ALTOVIZ_CREATE_SALE_INVOICE` | Create Sale Invoice | Creates a new draft sale invoice in Altoviz. The invoice is created in draft status and can be modified before being finalized. Use when you need to generate an invoice for a customer with line items. |
| `ALTOVIZ_DELETE_COLLEAGUE` | Delete Colleague | Tool to delete a colleague from Altoviz. Use when you need to permanently remove a colleague from the system. |
| `ALTOVIZ_DELETE_CUSTOMER` | Delete Customer | Tool to delete a customer from Altoviz. Use when you need to permanently remove a customer record from the system. Use ALTOVIZ_FIND_CUSTOMER first to look up customer IDs by email address if needed. |
| `ALTOVIZ_DELETE_CUSTOMER_FAMILY` | Delete Customer Family | Tool to delete a customer family from Altoviz. Use when you need to permanently remove a customer family from the system. |
| `ALTOVIZ_DELETE_PRODUCT` | Delete Product | This tool allows you to delete an existing product from Altoviz. The action permanently removes the product from the system. |
| `ALTOVIZ_DELETE_PRODUCT_FAMILY` | Delete Product Family | Tool to delete a product family from Altoviz. Use when you need to permanently remove a product family from the system. |
| `ALTOVIZ_DELETE_RECEIPT` | Delete Receipt | Tool to delete a receipt from Altoviz. Use when you need to permanently remove a receipt from the system. |
| `ALTOVIZ_DELETE_SALE_CREDIT` | Delete Draft Sale Credit | Tool to delete a draft credit from Altoviz. Use when you need to permanently remove a draft credit. Only draft credits can be deleted; finalized credits cannot be removed. |
| `ALTOVIZ_DELETE_SALE_INVOICE` | Delete Sale Invoice | Tool to delete a draft sale invoice from Altoviz. Use when you need to permanently remove a draft invoice from the system. Only draft invoices can be deleted; finalized invoices cannot be deleted. |
| `ALTOVIZ_DELETE_SALE_QUOTE` | Delete Sale Quote | Tool to delete a sale quote from Altoviz. Use when you need to permanently remove a quote from the system. |
| `ALTOVIZ_DELETE_SUPPLIER` | Delete Supplier | Tool to delete a supplier from Altoviz. Use when you need to permanently remove a supplier record from the system. |
| `ALTOVIZ_DOWNLOAD_PURCHASE_INVOICE` | Download Purchase Invoice | Tool to download a purchase invoice as a PDF file from Altoviz. Use when you need to retrieve the PDF document of a specific purchase invoice. |
| `ALTOVIZ_DOWNLOAD_SALE_CREDIT` | Download Sale Credit PDF | Tool to download a sale credit as a PDF file from Altoviz. Use when you need to retrieve the PDF version of a specific sale credit document. |
| `ALTOVIZ_DOWNLOAD_SALE_INVOICE` | Download Sale Invoice PDF | Tool to download a sale invoice as a PDF file from Altoviz. Use when you need to retrieve the PDF document of a specific sale invoice. |
| `ALTOVIZ_FIND_CONTACT` | Find Contact by Email | This tool allows searching for contacts in Altoviz using an email address. The action is independently executable and returns contact details if found. |
| `ALTOVIZ_FIND_CUSTOMER` | Find Customer by Email | This tool allows you to find a customer in Altoviz by their email address. This is a standalone action that doesn't require any resource IDs or dependencies on other tools. |
| `ALTOVIZ_FIND_PRODUCT` | Find Product by Number | Search for a product in Altoviz by its product number/SKU. Returns the first matching product with complete details including name, description, pricing, VAT, unit of measurement, and more. Returns null if no product matches. Use cases: - Look up a specific product by its SKU before creating an invoice - Verify a product exists before referencing it in orders - Retrieve product pricing and tax information |
| `ALTOVIZ_FIND_PRODUCT_BY_NUMBER_OR_ID` | Find Product by Number or Internal ID | Tool to find a product in Altoviz by exact product number or internal ID. Use when you need to look up a product by either its product number/SKU or your internal system ID. At least one of the parameters must be provided. |
| `ALTOVIZ_FIND_RECEIPT` | Find Receipt by Internal ID | Tool to find receipts in Altoviz by customer internal ID. Returns a list of receipts associated with the specified internal ID. If no internal ID is provided, may return all receipts. Use when you need to search for receipts by customer identifier. |
| `ALTOVIZ_FIND_SALE_CREDIT` | Find Sale Credits | Tool to find sale credits in Altoviz. Use when you need to search for or retrieve credit notes. Can filter by internal ID or return all credits if no filter is provided. |
| `ALTOVIZ_FIND_SALE_INVOICE` | Find Sale Invoices | Tool to find sale invoices in Altoviz. Use when you need to search for or retrieve invoices. Can filter by internal ID or return all invoices if no filter is provided. |
| `ALTOVIZ_FIND_SALE_QUOTE` | Find Sale Quotes | Tool to find sale quotes in Altoviz. Use when you need to search for or retrieve quotations. Can filter by internal ID or return all quotes if no filter is provided. |
| `ALTOVIZ_GET_CLASSIFICATIONS` | Get Classifications List | This tool retrieves a list of classifications from the Altoviz platform. Classifications are essential for producing accounting registers from user-created invoices. It can fetch all classifications or filter them by type. |
| `ALTOVIZ_GET_COLLEAGUE` | Get Colleague by ID | Tool to retrieve a colleague's details from Altoviz by their ID. Use this when you need to fetch information about a specific colleague including their contact information, partner status, and metadata. |
| `ALTOVIZ_GET_CONTACT` | Get Contact by ID | Tool to retrieve a contact by its unique ID from Altoviz. Use when you need to fetch detailed information about a specific contact. |
| `ALTOVIZ_GET_CURRENT_USER` | Get Current User | Tool to retrieve the current authenticated user's information from Altoviz. Use when you need to get details about the currently authenticated user. |
| `ALTOVIZ_GET_CUSTOMER` | Get Customer by ID | Tool to retrieve a customer by their ID from Altoviz. Use when you need detailed information about a specific customer. |
| `ALTOVIZ_GET_CUSTOMER_BY_INTERNAL_ID` | Get Customer by Internal ID | Tool to retrieve a single customer from Altoviz by their internal ID. Use when you need to fetch detailed information about a specific customer using their internal identifier. |
| `ALTOVIZ_GET_CUSTOMER_CONTACTS` | Get Customer Contacts | Tool to retrieve all contacts associated with a specific customer in Altoviz. Use when you need to get contact information for a customer using their customer ID. |
| `ALTOVIZ_GET_CUSTOMER_FAMILY` | Get Customer Family | Tool to retrieve a customer family by ID from Altoviz. Use when you need to fetch details of a specific customer family. |
| `ALTOVIZ_GET_PRODUCT` | Get Product by ID | Tool to retrieve a product by its unique ID in Altoviz. Use when you need complete details about a specific product including pricing, VAT, units, and inventory information. |
| `ALTOVIZ_GET_PRODUCT_FAMILY` | Get Product Family by ID | Tool to retrieve a specific product family by its ID from Altoviz. Use when you need to fetch details about a product category or family grouping. |
| `ALTOVIZ_GET_RECEIPT` | Get Receipt by ID | Tool to retrieve a receipt by its ID from Altoviz. Use when you need to fetch details of a specific receipt including amount, payment method, status, and customer information. |
| `ALTOVIZ_GET_SALE_CREDIT` | Get Sale Credit by ID | Tool to retrieve a sale credit by its ID from Altoviz. Use when you need to get detailed information about a specific credit. |
| `ALTOVIZ_GET_SALE_INVOICE` | Get Sale Invoice by ID | Tool to retrieve a sale invoice by its ID from Altoviz. Use when you need to get detailed information about a specific invoice. |
| `ALTOVIZ_GET_SETTINGS` | Get Settings | Tool to retrieve application settings from Altoviz. Use when you need to access configuration for accounting, company information, emailing, sales, social media, or VAT settings. |
| `ALTOVIZ_GET_SUPPLIER` | Get Supplier by ID | Tool to retrieve a supplier by their ID from Altoviz. Use when you need detailed information about a specific supplier. |
| `ALTOVIZ_GET_SUPPLIER_CONTACTS` | Get Supplier Contacts | Tool to retrieve all contacts associated with a specific supplier in Altoviz. Use when you need to get contact information for a supplier using their supplier ID. |
| `ALTOVIZ_GET_UNITS` | Get Units List | This tool retrieves a list of all available units in the Altoviz system. Units are used for product measurements and quantity specifications in various transactions. |
| `ALTOVIZ_GET_VATS` | Get VAT Rates | This tool retrieves a list of all available VAT rates from Altoviz. It's essential for creating and managing invoices and quotes where VAT calculations are required. It supports retrieving VAT rates, validating them for different regions, and ensuring correct tax calculations in financial documents. |
| `ALTOVIZ_LIST_COLLEAGUES` | List Colleagues | Retrieves a list of colleagues from Altoviz. Supports pagination, sorting, and full-text search. Use this to discover available colleagues, search for specific team members, or list all colleagues in the system. |
| `ALTOVIZ_LIST_CONTACTS` | List Contacts | Tool to retrieve a list of contacts from Altoviz with optional filtering and pagination. Use when you need to browse or search through available contacts. |
| `ALTOVIZ_LIST_CUSTOMER_FAMILIES` | List Customer Families | Tool to list customer families from Altoviz. Use when you need to retrieve or search through customer family groups. Supports pagination and full-text search to filter results. |
| `ALTOVIZ_LIST_CUSTOMERS` | List Customers | Tool to retrieve a paginated list of customers from Altoviz. Use when you need to browse all customers, search for customers by name/email/company, or fetch multiple customers at once. Supports pagination, sorting, and full-text search across customer fields. |
| `ALTOVIZ_LIST_PRODUCT_FAMILIES` | List Product Families | Tool to retrieve a list of product families from Altoviz. Use when you need to browse available product families, search for specific families, or get family information for product categorization. |
| `ALTOVIZ_LIST_RECEIPTS` | List Receipts | Tool to retrieve a list of receipts from Altoviz. Use this when you need to view, search, or filter receipts by pagination, ordering, or full-text search. |
| `ALTOVIZ_LIST_SALE_CREDITS` | List Sale Credits | Tool to retrieve a list of sale credits from Altoviz. Use when you need to view credit notes issued to customers, filter by date range, or find credits for a specific customer. Supports pagination and sorting for efficient data retrieval. |
| `ALTOVIZ_LIST_SALE_INVOICES` | List Sale Invoices | Tool to retrieve a list of sale invoices from Altoviz. Use when you need to view invoices issued to customers, filter by date range, status, or find invoices for a specific customer. Supports pagination, sorting, and status filtering for efficient data retrieval. |
| `ALTOVIZ_LIST_SALE_QUOTES` | List Sale Quotes | Tool to retrieve a list of sale quotes from Altoviz. Use when you need to view quotes issued to customers, filter by date range, or find quotes for a specific customer. Supports pagination and sorting for efficient data retrieval. |
| `ALTOVIZ_LIST_SUPPLIERS` | List Suppliers | Tool to retrieve a paginated list of suppliers from Altoviz. Use when you need to browse all suppliers, search for suppliers by name/email/company, or fetch multiple suppliers at once. Supports pagination, sorting, and full-text search across supplier fields. |
| `ALTOVIZ_LIST_WEBHOOKS` | List Webhooks | Tool to retrieve all configured webhooks from Altoviz. Use when you need to view all webhook configurations, including their URLs, event types, and authentication details. |
| `ALTOVIZ_REGISTER_WEBHOOK` | Register Webhook | Tool to register a new webhook in Altoviz. Use when you need to receive real-time notifications for events like customer creation, invoice updates, or product changes. |
| `ALTOVIZ_TEST_API_KEY` | Test API Key | Tool to test API key validity and retrieve basic account information. Use this action to verify that the API key is working correctly and to get basic information about the authenticated account. |
| `ALTOVIZ_UNREGISTER_WEBHOOK` | Unregister Webhook | Tool to unregister a webhook from Altoviz. Use when you need to remove a webhook configuration. Either webhook ID or URL must be provided to identify which webhook to unregister. |
| `ALTOVIZ_UPDATE_COLLEAGUE` | Update Colleague Information | Updates an existing colleague's information in Altoviz. Only fields that are provided will be updated; omitted fields retain their current values. Use this action to modify colleague details such as contact information, partner status, and associated metadata. |
| `ALTOVIZ_UPDATE_CUSTOMER` | Update Customer Information | Updates an existing customer's information in Altoviz. Only fields that are provided will be updated; omitted fields retain their current values. Important: For Individual customers, you must provide either last_name or company_name. Setting company_name will change the customer type to Company. Use ALTOVIZ_FIND_CUSTOMER first to look up customer IDs by email address. |
| `ALTOVIZ_UPDATE_RECEIPT` | Update Receipt | Updates an existing receipt in Altoviz. Only fields that are provided will be updated; omitted fields retain their current values. Use this to modify receipt details such as amount, date, payment method, status, or notes. |
| `ALTOVIZ_UPDATE_SALE_CREDIT` | Update Sale Credit | Tool to update a draft credit note in Altoviz. Use when you need to modify an existing draft credit. Only draft credits can be updated; finalized credits cannot be modified. |
| `ALTOVIZ_UPDATE_SUPPLIER` | Update Supplier Information | Updates an existing supplier's information in Altoviz. Only fields that are provided will be updated; omitted fields retain their current values. Use this when you need to modify supplier details such as contact information, address, payment terms, or internal notes. |
| `ALTOVIZ_UPLOAD_PURCHASE_INVOICE` | Upload Purchase Invoice | Tool to upload and create a new purchase invoice from a file (PDF or image format). Use when you need to create a purchase invoice by uploading a document. |

## Supported Triggers

None listed.

## Creating MCP Server - Stand-alone vs Composio SDK

The Altoviz MCP server is an implementation of the Model Context Protocol that connects your AI agent to Altoviz. It provides structured and secure access so your agent can perform Altoviz operations on your behalf through a secure, permission-based interface.
With Composio's managed implementation, you don't have to create your own developer app. For production, if you're building an end product, we recommend using your own credentials. The managed server helps you prototype fast and go from 0-1 faster.

## Step-by-step Guide

### 1. Prerequisites

Before starting, make sure you have:
- Python 3.9 or higher
- A Composio account with an active API key
- Basic familiarity with Python and async programming

### 1. Getting API Keys for OpenAI and Composio

OpenAI API Key
- Go to the [OpenAI dashboard](https://platform.openai.com/settings/organization/api-keys) and create an API key. You'll need credits to use the models, or you can connect to another model provider.
- Keep the API key safe.
Composio API Key
- Log in to the [Composio dashboard](https://dashboard.composio.dev?utm_source=toolkits&utm_medium=framework_docs).
- Navigate to your API settings and generate a new API key.
- Store this key securely as you'll need it for authentication.

### 2. Install dependencies

Install the required libraries.
What's happening:
- composio connects your agent to external SaaS tools like Altoviz
- pydantic-ai lets you create structured AI agents with tool support
- python-dotenv loads your environment variables securely from a .env file
```bash
pip install composio pydantic-ai python-dotenv
```

### 3. Set up environment variables

Create a .env file in your project root.
What's happening:
- COMPOSIO_API_KEY authenticates your agent to Composio's API
- USER_ID associates your session with your account for secure tool access
- OPENAI_API_KEY to access OpenAI LLMs
```bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here
OPENAI_API_KEY=your_openai_api_key
```

### 4. Import dependencies

What's happening:
- We load environment variables and import required modules
- Composio manages connections to Altoviz
- MCPServerStreamableHTTP connects to the Altoviz MCP server endpoint
- Agent from Pydantic AI lets you define and run the AI assistant
```python
import asyncio
import os
from dotenv import load_dotenv
from composio import Composio
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStreamableHTTP

load_dotenv()
```

### 5. Create a Tool Router Session

What's happening:
- We're creating a Tool Router session that gives your agent access to Altoviz tools
- The create method takes the user ID and specifies which toolkits should be available
- The returned session.mcp.url is the MCP server URL that your agent will use
```python
async def main():
    api_key = os.getenv("COMPOSIO_API_KEY")
    user_id = os.getenv("USER_ID")
    if not api_key or not user_id:
        raise RuntimeError("Set COMPOSIO_API_KEY and USER_ID in your environment")

    # Create a Composio Tool Router session for Altoviz
    composio = Composio(api_key=api_key)
    session = composio.create(
        user_id=user_id,
        toolkits=["altoviz"],
    )
    url = session.mcp.url
    if not url:
        raise ValueError("Composio session did not return an MCP URL")
```

### 6. Initialize the Pydantic AI Agent

What's happening:
- The MCP client connects to the Altoviz endpoint
- The agent uses GPT-5 to interpret user commands and perform Altoviz operations
- The instructions field defines the agent's role and behavior
```python
# Attach the MCP server to a Pydantic AI Agent
altoviz_mcp = MCPServerStreamableHTTP(url, headers={"x-api-key": COMPOSIO_API_KEY})
agent = Agent(
    "openai:gpt-5",
    toolsets=[altoviz_mcp],
    instructions=(
        "You are a Altoviz assistant. Use Altoviz tools to help users "
        "with their requests. Ask clarifying questions when needed."
    ),
)
```

### 7. Build the chat interface

What's happening:
- The agent reads input from the terminal and streams its response
- Altoviz API calls happen automatically under the hood
- The model keeps conversation history to maintain context across turns
```python
# Simple REPL with message history
history = []
print("Chat started! Type 'exit' or 'quit' to end.\n")
print("Try asking the agent to help you with Altoviz.\n")

while True:
    user_input = input("You: ").strip()
    if user_input.lower() in {"exit", "quit", "bye"}:
        print("\nGoodbye!")
        break
    if not user_input:
        continue

    print("\nAgent is thinking...\n", flush=True)

    async with agent.run_stream(user_input, message_history=history) as stream_result:
        collected_text = ""
        async for chunk in stream_result.stream_output():
            text_piece = None
            if isinstance(chunk, str):
                text_piece = chunk
            elif hasattr(chunk, "delta") and isinstance(chunk.delta, str):
                text_piece = chunk.delta
            elif hasattr(chunk, "text"):
                text_piece = chunk.text
            if text_piece:
                collected_text += text_piece
        result = stream_result

    print(f"Agent: {collected_text}\n")
    history = result.all_messages()
```

### 8. Run the application

What's happening:
- The asyncio loop launches the agent and keeps it running until you exit
```python
if __name__ == "__main__":
    asyncio.run(main())
```

## Complete Code

```python
import asyncio
import os
from dotenv import load_dotenv
from composio import Composio
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStreamableHTTP

load_dotenv()

async def main():
    api_key = os.getenv("COMPOSIO_API_KEY")
    user_id = os.getenv("USER_ID")
    if not api_key or not user_id:
        raise RuntimeError("Set COMPOSIO_API_KEY and USER_ID in your environment")

    # Create a Composio Tool Router session for Altoviz
    composio = Composio(api_key=api_key)
    session = composio.create(
        user_id=user_id,
        toolkits=["altoviz"],
    )
    url = session.mcp.url
    if not url:
        raise ValueError("Composio session did not return an MCP URL")

    # Attach the MCP server to a Pydantic AI Agent
    altoviz_mcp = MCPServerStreamableHTTP(url, headers={"x-api-key": COMPOSIO_API_KEY})
    agent = Agent(
        "openai:gpt-5",
        toolsets=[altoviz_mcp],
        instructions=(
            "You are a Altoviz assistant. Use Altoviz tools to help users "
            "with their requests. Ask clarifying questions when needed."
        ),
    )

    # Simple REPL with message history
    history = []
    print("Chat started! Type 'exit' or 'quit' to end.\n")
    print("Try asking the agent to help you with Altoviz.\n")

    while True:
        user_input = input("You: ").strip()
        if user_input.lower() in {"exit", "quit", "bye"}:
            print("\nGoodbye!")
            break
        if not user_input:
            continue

        print("\nAgent is thinking...\n", flush=True)

        async with agent.run_stream(user_input, message_history=history) as stream_result:
            collected_text = ""
            async for chunk in stream_result.stream_output():
                text_piece = None
                if isinstance(chunk, str):
                    text_piece = chunk
                elif hasattr(chunk, "delta") and isinstance(chunk.delta, str):
                    text_piece = chunk.delta
                elif hasattr(chunk, "text"):
                    text_piece = chunk.text
                if text_piece:
                    collected_text += text_piece
            result = stream_result

        print(f"Agent: {collected_text}\n")
        history = result.all_messages()

if __name__ == "__main__":
    asyncio.run(main())
```

## Conclusion

You've built a Pydantic AI agent that can interact with Altoviz through Composio's Tool Router. With this setup, your agent can perform real Altoviz actions through natural language.
You can extend this further by:
- Adding other toolkits like Gmail, HubSpot, or Salesforce
- Building a web-based chat interface around this agent
- Using multiple MCP endpoints to enable cross-app workflows (for example, Gmail + Altoviz for workflow automation)
This architecture makes your AI agent "agent-native", able to securely use APIs in a unified, composable way without custom integrations.

## How to build Altoviz MCP Agent with another framework

- [Claude Code](https://composio.dev/toolkits/altoviz/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/altoviz/framework/claude-cowork)
- [OpenAI Agents SDK](https://composio.dev/toolkits/altoviz/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/altoviz/framework/claude-agents-sdk)
- [Codex](https://composio.dev/toolkits/altoviz/framework/codex)
- [OpenClaw](https://composio.dev/toolkits/altoviz/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/altoviz/framework/hermes-agent)
- [Atomic Agent](https://composio.dev/toolkits/altoviz/framework/atomic-agent)
- [Google ADK](https://composio.dev/toolkits/altoviz/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/altoviz/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/altoviz/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/altoviz/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/altoviz/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/altoviz/framework/crew-ai)
- [AutoGen](https://composio.dev/toolkits/altoviz/framework/autogen)

## Related Toolkits

- [Stripe](https://composio.dev/toolkits/stripe) - Stripe is a global online payments platform offering APIs for managing payments, customers, and subscriptions. Trusted by businesses for secure, efficient, and scalable payment processing worldwide.
- [44API](https://composio.dev/toolkits/44api) - 44API is an API service for validating VAT and tax identifiers and returning company details. Use it to verify business tax data and manage account IP whitelists quickly.
- [Airwallex](https://composio.dev/toolkits/airwallex) - Airwallex is a global financial platform providing business accounts, payments, payouts, FX, and cards. Built to simplify cross-border payments and streamline financial operations for businesses.
- [Aiwyn Tax MCP](https://composio.dev/toolkits/aiwyn_tax_mcp) - Aiwyn Tax MCP is a tax estimation service powered by Aiwyn's federal and state tax engine. It helps teams estimate tax outcomes without building tax calculation logic from scratch.
- [Alpaca](https://composio.dev/toolkits/alpaca) - Alpaca is a stock and crypto trading platform for commission-free trading, real-time market data, and algorithmic strategies. Use it to build brokerage apps, trading bots, and portfolio workflows with market connectivity.
- [Alpha vantage](https://composio.dev/toolkits/alpha_vantage) - Alpha Vantage is a financial data platform offering real-time and historical stock market APIs. Get instant, reliable access to equities, forex, and technical analysis data for smarter trading decisions.
- [Benzinga](https://composio.dev/toolkits/benzinga) - Benzinga provides real-time financial news and data APIs for market coverage. It helps you track breaking news and actionable market insights instantly.
- [Bigdata.com MCP](https://composio.dev/toolkits/bigdata_com_mcp) - Bigdata.com MCP provides grounded access to financial news, transcripts, filings, and entity intelligence. Ideal for building research workflows and generating timely market insights.
- [Billsby](https://composio.dev/toolkits/billsby) - Billsby is a subscription billing platform for managing customers, subscriptions, invoices, products, plans, usage counters, add-ons, and allowances. It helps SaaS and subscription teams automate billing operations without building complex billing logic from scratch.
- [Brex](https://composio.dev/toolkits/brex) - Brex provides corporate credit cards and spend management tailored for startups and tech businesses. It helps optimize company cash flow, streamline accounting, and accelerate business growth.
- [Cashfree Payments MCP](https://composio.dev/toolkits/cashfree_payments_mcp) - Cashfree Payments MCP is a merchant payments platform that handles collection, payouts, subscriptions, settlements, refunds, and identity verification. Simplifies merchant money lifecycle management with unified, API-driven workflows.
- [Chaser](https://composio.dev/toolkits/chaser) - Chaser is accounts receivable automation software that sends invoice reminders and helps businesses get paid faster. It streamlines the collections process to save time and improve cash flow.
- [Clarity AI MCP](https://composio.dev/toolkits/clarity_ai_mcp) - Clarity AI MCP is an MCP toolkit for simulating SFDR 2.0 fund classifications from a fund name, ISIN, or CUSIP. Use it to tap Clarity AI disclosure data and modeling without building custom sustainability-data workflows.
- [Clientary](https://composio.dev/toolkits/clientary) - Clientary is a platform for managing clients, invoices, projects, proposals, and more. It streamlines client work and saves you serious admin time.
- [Coinbase](https://composio.dev/toolkits/coinbase) - Coinbase is a platform for buying, selling, and storing cryptocurrency. It makes exchanging and managing crypto simple and secure for everyone.
- [Coinbase Agents MCP](https://composio.dev/toolkits/coinbase_agents_mcp) - Coinbase Agents MCP is Coinbase's managed toolkit exposing accounts, portfolios, orders, fills, and market data. Use it to let authorized agents inspect holdings, execute trades, perform transfers, and handle payments.
- [Coinbase Wallet MCP](https://composio.dev/toolkits/coinbase_wallet_mcp) - Coinbase Wallet MCP is Coinbase's wallet service for interacting with onchain accounts. Use it to give agents secure, structured access to inspect wallets and request onchain actions.
- [Coinranking](https://composio.dev/toolkits/coinranking) - Coinranking is a comprehensive cryptocurrency market data platform offering access to real-time coin prices, market caps, and historical data. Get accurate, up-to-date stats for thousands of digital assets in one place.
- [Coupa](https://composio.dev/toolkits/coupa) - Coupa is a business spend management platform for procurement, invoicing, and expenses. It helps organizations streamline purchasing, control costs, and gain complete visibility over financial operations.
- [CurrencyScoop](https://composio.dev/toolkits/currencyscoop) - CurrencyScoop is a developer-friendly API for real-time and historical currency exchange rates. Easily access fiat and crypto data for smart, up-to-date financial applications.

## Frequently Asked Questions

### What are the differences in Tool Router MCP and Altoviz MCP?

With a standalone Altoviz MCP server, the agents and LLMs can only access a fixed set of Altoviz tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Altoviz and many other apps based on the task at hand, all through a single MCP endpoint.

### Can I use Tool Router MCP with Pydantic AI?

Yes, you can. Pydantic AI fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right Altoviz tools.

### Can I manage the permissions and scopes for Altoviz while using Tool Router?

Yes, absolutely. You can configure which Altoviz scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

### How safe is my data with Composio Tool Router?

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your Altoviz data and credentials are handled as safely as possible.

---
[See all toolkits](https://composio.dev/toolkits) · [Composio docs](https://docs.composio.dev/llms.txt)
