# How to integrate Render MCP with Pydantic AI

```json
{
  "title": "How to integrate Render MCP with Pydantic AI",
  "toolkit": "Render",
  "toolkit_slug": "render",
  "framework": "Pydantic AI",
  "framework_slug": "pydantic-ai",
  "url": "https://composio.dev/toolkits/render/framework/pydantic-ai",
  "markdown_url": "https://composio.dev/toolkits/render/framework/pydantic-ai.md",
  "updated_at": "2026-05-12T10:23:45.398Z"
}
```

## Introduction

This guide walks you through connecting Render to Pydantic AI using the Composio tool router. By the end, you'll have a working Render agent that can deploy latest code to staging service, restart production web service now, get current status of all services through natural language commands.
This guide will help you understand how to give your Pydantic AI agent real control over a Render account through Composio's Render MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate Render with

- [ChatGPT](https://composio.dev/toolkits/render/framework/chatgpt)
- [OpenAI Agents SDK](https://composio.dev/toolkits/render/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/render/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/render/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/render/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/render/framework/codex)
- [Cursor](https://composio.dev/toolkits/render/framework/cursor)
- [VS Code](https://composio.dev/toolkits/render/framework/vscode)
- [OpenCode](https://composio.dev/toolkits/render/framework/opencode)
- [OpenClaw](https://composio.dev/toolkits/render/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/render/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/render/framework/cli)
- [Google ADK](https://composio.dev/toolkits/render/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/render/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/render/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/render/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/render/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/render/framework/crew-ai)

## 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 Render
- 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 Render 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 Render MCP server, and what's possible with it?

The Render MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Render account. It provides structured and secure access to your cloud infrastructure, so your agent can perform actions like deploying applications, managing services, monitoring site health, restarting instances, and scaling resources on your behalf.
- Automated application deployment: Instantly deploy new web apps or services without manual steps, letting your agent handle setup and rollouts.
- Service monitoring and status checks: Ask your agent to check the health and uptime of your apps or services, so you’re always up to speed on what’s running smoothly—and what’s not.
- Instance management and restarts: Enable your agent to restart, stop, or scale up/down your running services to quickly respond to changes or issues.
- Resource scaling and configuration: Let your agent adjust resource allocations, increasing or decreasing capacity based on current needs or traffic spikes.
- Error diagnostics and log retrieval: Have your agent fetch logs or error reports to help troubleshoot issues before they become major problems.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `RENDER_ADD_HEADERS` | Add Header Rule | Tool to add a custom HTTP header rule to a Render service. Use when you need to configure headers like Cache-Control, security headers, or CORS headers for specific request paths. |
| `RENDER_ADD_OR_UPDATE_SECRET_FILE` | Add or Update Secret File | Tool to add or update a secret file for a Render service. Use when you need to create a new secret file or update the content of an existing secret file. |
| `RENDER_ADD_RESOURCES_TO_ENVIRONMENT` | Add Resources to Environment | Tool to add resources to a Render environment. Use when you need to associate services, databases, Redis instances, or environment groups with an existing environment. |
| `RENDER_ADD_ROUTE` | Add Route | Tool to add redirect or rewrite rules to a Render service. Use when you need to configure URL routing, redirects, or rewrites for a service. Redirect rules send HTTP redirects to clients, while rewrite rules modify the request path internally. |
| `RENDER_CREATE_CUSTOM_DOMAIN` | Create Custom Domain | Tool to add a custom domain to a Render service. Use when you need to configure a custom domain for a service. |
| `RENDER_CREATE_ENV_GROUP` | Create Environment Group | Tool to create a new environment group. Use when you need to create a shared collection of environment variables and secret files that can be used across multiple services. |
| `RENDER_CREATE_ENVIRONMENT` | Create Environment | Tool to create a new environment within a Render project. Use when you need to set up a new environment for organizing services, databases, and other resources. |
| `RENDER_CREATE_POSTGRES` | Create Postgres Instance | Tool to create a new Postgres instance on Render. Use when you need to provision a new PostgreSQL database with configurable plan, version, and region. |
| `RENDER_CREATE_REGISTRY_CREDENTIAL` | Create Registry Credential | Tool to create a registry credential. Use when you need to add a new container registry credential to your Render account for authenticating with Docker Hub, GitHub, GitLab, Google Artifact Registry, or AWS ECR. |
| `RENDER_DELETE_ENV_GROUP_ENV_VAR` | Delete Environment Group Variable | Tool to remove an environment variable from an environment group. Use when you need to delete a specific environment variable by its key from a given environment group. |
| `RENDER_DELETE_ENV_GROUP_SECRET_FILE` | Delete Environment Group Secret File | Tool to remove a secret file from an environment group. Use when you need to delete a specific secret file by its name from a given environment group. |
| `RENDER_DELETE_ENVIRONMENT` | Delete Environment | Tool to delete a specified environment. Use when you need to remove an environment from Render. Returns success confirmation. |
| `RENDER_DELETE_KEY_VALUE` | Delete Key Value | Tool to delete a Key Value instance. Use when you need to remove a specific Key Value store from your Render account. |
| `RENDER_DELETE_OWNER_LOG_STREAM` | Delete Owner Log Stream | Tool to delete a log stream for an owner. Use when you need to remove log stream configuration for a specific workspace. |
| `RENDER_DELETE_OWNER_METRICS_STREAM` | Delete Owner Metrics Stream | Tool to delete a metrics stream for a workspace. Use when removing metrics integration for a specific owner. |
| `RENDER_DELETE_REGISTRY_CREDENTIAL` | Delete Registry Credential | Tool to delete a registry credential. Use when you need to remove a Docker registry credential from your Render account. |
| `RENDER_DELETE_SECRET_FILE` | Delete Secret File | Tool to delete a secret file from a Render service. Use when you need to remove a secret file that is no longer needed. |
| `RENDER_DELETE_SERVICE` | Delete Service | Tool to delete a service. Use when you need to permanently remove a service from your Render account. |
| `RENDER_DISCONNECT_BLUEPRINT` | Disconnect Blueprint | Tool to disconnect a blueprint from your Render account. Use when you need to remove a blueprint connection. |
| `RENDER_GET_ACTIVE_CONNECTIONS` | Get Active Connections | Tool to get active connection count metrics for Render resources. Use when you need to retrieve time-series data of active connections for Postgres or Redis instances over a specified time range. |
| `RENDER_GET_BANDWIDTH_SOURCES` | Get Bandwidth Sources | Tool to get bandwidth usage breakdown by traffic source. Use when you need to retrieve bandwidth usage statistics segmented by different traffic sources for a Render service. |
| `RENDER_GET_CPU` | Get CPU Usage | Tool to retrieve CPU usage metrics for Render resources. Use when you need to monitor CPU utilization for services, Postgres databases, or Redis instances. At least one filter (resource, service, or instance) must be provided. |
| `RENDER_GET_CPU_LIMIT` | Get CPU Limit | Tool to retrieve CPU limit metrics for Render resources. Use when you need to get the CPU limit time series data for services, Postgres databases, or Redis instances. Returns metrics over a specified time range with configurable resolution. |
| `RENDER_GET_DISK_CAPACITY` | Get Disk Capacity | Tool to get disk capacity metrics for Render resources. Use when you need to retrieve disk capacity time series data for services, Postgres databases, or Redis instances. At least one filter parameter (resource or service) must be specified. |
| `RENDER_GET_DISK_USAGE` | Get Disk Usage | Tool to retrieve disk usage metrics for Render resources. Use when you need to monitor persistent disk utilization for services, Postgres databases, or Redis instances. It is recommended to specify at least one resource filter. |
| `RENDER_GET_INSTANCE_COUNT` | Get Instance Count | Tool to get instance count metrics for Render resources. Use when you need to retrieve instance count time series data for services, Postgres databases, or Redis instances. The resource parameter is required. |
| `RENDER_GET_MEMORY` | Get Memory Usage | Tool to get memory usage metrics for one or more resources. Use when you need to retrieve memory usage data for services, Postgres databases, or Redis instances over a specified time range. |
| `RENDER_GET_MEMORY_LIMIT` | Get Memory Limit | Tool to get memory limit metrics for Render resources over a specified time range. Use when you need to retrieve memory limit data for services, Postgres databases, or Redis instances. At least one filter (resource, service, or instance) must be provided. |
| `RENDER_GET_MEMORY_TARGET` | Get Memory Target | Tool to get memory target metrics for Render resources. Use when you need to retrieve memory target data for services, Postgres databases, or Redis instances over a specified time range. At least one resource identifier (resource, service, or instance) is required. |
| `RENDER_GET_USER` | Get User | Tool to get the authenticated user. Use when you need to retrieve information about the currently authenticated account owner. |
| `RENDER_LINK_SERVICE_TO_ENV_GROUP` | Link Service to Environment Group | Tool to link a service to an environment group. Use when you need to associate a service with an environment group so that the service can access the environment variables and secret files defined in that group. |
| `RENDER_LIST_APPLICATION_FILTER_VALUES` | List Application Filter Values | Tool to list queryable instance values for application metrics. Use when you need to discover available filter values for metrics queries. |
| `RENDER_LIST_BLUEPRINTS` | List Blueprints | Tool to list all blueprints. Use when you need to retrieve the definitions of all blueprints in your account. |
| `RENDER_LIST_DEPLOYS` | List Deploys | Tool to list recent deploys for a Render service with pagination and filtering. Use when you need to fetch deploy history, inspect deploy statuses, or find a specific deployId to pass to other deploy operations. |
| `RENDER_LIST_DISKS` | List Disks | Tool to list all disks. Use when you need to retrieve all disks associated with your account. |
| `RENDER_LIST_ENV_GROUPS` | List Environment Groups | Tool to list environment groups. Use when you need to retrieve environment groups to view shared environment variables across services. |
| `RENDER_LIST_ENVIRONMENTS` | List Environments | Tool to list environments for a project. Use when you need to retrieve environments within a specific project. Requires at least one project ID. |
| `RENDER_LIST_ENV_VARS_FOR_SERVICE` | List Environment Variables for Service | Tool to list all environment variables configured directly on a Render service (with pagination). Use when you need to enumerate env vars without knowing individual keys. |
| `RENDER_LIST_INSTANCES` | List Instances | Tool to list instances of a service. Use when you need to retrieve all instances for a specific Render service. |
| `RENDER_LIST_KEY_VALUE` | List Key Value Instances | Tool to list all Key Value instances. Use when you need to retrieve Key Value instances associated with your account, optionally filtering by name, region, owner, environment, or timestamps. |
| `RENDER_LIST_LOGS` | List Logs | Tool to list logs for a specific workspace and resource. Use when you need to retrieve logs for services, databases, or other resources, with support for filtering by time range, log type, severity level, and text content. Wildcards and regex patterns are supported for most text filters. |
| `RENDER_LIST_LOGS_VALUES` | List Log Label Values | Tool to list log label values for a workspace. Use when you need to discover possible values for a specific log label (instance, host, statusCode, method, level, or type) within a time range. |
| `RENDER_LIST_MAINTENANCE` | List Maintenance Runs | Tool to list maintenance runs. Use when you need to retrieve scheduled or past maintenance activities for services and database instances. |
| `RENDER_LIST_NOTIFICATION_OVERRIDES` | List Notification Overrides | Tool to list notification overrides for services. Use when you need to retrieve notification settings that override default notification behavior for specific services. |
| `RENDER_LIST_OWNER_MEMBERS` | List Workspace Members | Tool to list workspace members. Use when you need to retrieve all members of a specific workspace or team. |
| `RENDER_LIST_OWNERS` | List Owners | Tool to list owners (users and teams). Use after authenticating to fetch available owner IDs for resource creation. |
| `RENDER_LIST_POSTGRES` | List Postgres Instances | Tool to list Postgres instances. Use when you need to retrieve all Postgres databases associated with your account, optionally filtering by name, region, or other criteria. |
| `RENDER_LIST_POSTGRES_EXPORT` | List Postgres Exports | Tool to list all exports for a Postgres instance. Use when you need to retrieve the history of exports for a specific Postgres database. |
| `RENDER_LIST_POSTGRES_USERS` | List PostgreSQL Users | Tool to list PostgreSQL user credentials for a Render PostgreSQL database instance. Use when you need to view all users with access to a specific PostgreSQL database. |
| `RENDER_LIST_PROJECTS` | List Projects | List Projects |
| `RENDER_LIST_REGISTRY_CREDENTIALS` | List Registry Credentials | Tool to list registry credentials. Use when you need to retrieve container registry credentials associated with your account, optionally filtering by name, username, or registry type. |
| `RENDER_LIST_RESOURCE_LOG_STREAMS` | List Resource Log Streams | Tool to list resource log stream overrides. Use when you need to retrieve log stream configurations for resources in your account. |
| `RENDER_LIST_ROUTES` | List Routes | Tool to list redirect/rewrite rules for a service. Use when you need to retrieve routing configuration for a Render service. |
| `RENDER_LIST_SECRET_FILES` | List Secret Files | Tool to list secret files for a Render service. Use when you need to retrieve all secret files associated with a specific service. |
| `RENDER_LIST_SERVICES` | List Services | Tool to list all services. Use when you need to retrieve services accessible by your account, optionally filtering by name or type. Use after authentication. |
| `RENDER_LIST_TASK_RUNS` | List Task Runs | Tool to list task runs. Use when you need to retrieve task execution history for workflows, optionally filtering by task ID, workflow, owner, or root task run. |
| `RENDER_LIST_TASKS` | List Tasks | Tool to list tasks. Use when you need to retrieve tasks from workflows, optionally filtering by owner, task ID, workflow ID, or workflow version ID. |
| `RENDER_LIST_WEBHOOKS` | List Webhooks | Tool to list all webhooks. Use when you need to retrieve configured webhooks for your account. |
| `RENDER_LIST_WORKFLOWS` | List Workflows | Tool to list workflows. Use when you need to retrieve workflows accessible by your account, optionally filtering by name, owner, environment, or workflow ID. |
| `RENDER_LIST_WORKFLOW_VERSIONS` | List Workflow Versions | Tool to list workflow versions. Use when you need to retrieve workflow versions, optionally filtering by owner, workflow, or version ID. |
| `RENDER_RESTART_SERVICE` | Restart Service | Tool to restart a service. Use when you need to restart a running service, such as after configuration changes or to resolve issues. |
| `RENDER_RESUME_SERVICE` | Resume Service | Tool to resume a suspended service. Use when you need to restart a service that was previously suspended. |
| `RENDER_RETRIEVE_CUSTOM_DOMAIN` | Retrieve Custom Domain | Tool to retrieve a specific custom domain for a service. Use when you need to get details about a custom domain associated with a Render service. |
| `RENDER_RETRIEVE_DEPLOY` | Retrieve deploy | Retrieve deploy |
| `RENDER_RETRIEVE_ENV_GROUP` | Retrieve Environment Group | Tool to retrieve a specific environment group by ID. Use when you need to fetch detailed information about a specific environment group including its environment variables, secret files, and linked services. |
| `RENDER_RETRIEVE_ENV_GROUP_ENV_VAR` | Retrieve Environment Variable | Tool to retrieve a specific environment variable from a Render environment group. Use when you need to fetch the value of a particular environment variable by its key. |
| `RENDER_RETRIEVE_ENV_GROUP_SECRET_FILE` | Retrieve Environment Group Secret File | Tool to retrieve secret file from an environment group. Use when you need to get the content of a specific secret file within an environment group. |
| `RENDER_RETRIEVE_ENV_VAR` | Retrieve Environment Variable | Tool to retrieve a specific environment variable from a Render service. Use when you need to fetch the value of a particular environment variable by its key. |
| `RENDER_RETRIEVE_OWNER` | Retrieve Owner | Tool to retrieve a specific owner (workspace) by ID. Use when you need details about a user or team workspace. |
| `RENDER_RETRIEVE_OWNER_NOTIFICATION_SETTINGS` | Retrieve Owner Notification Settings | Tool to retrieve notification settings for a specific owner (workspace). Use when you need to check current notification configuration for Slack, email, and preview notifications. |
| `RENDER_RETRIEVE_POSTGRES` | Retrieve Postgres Instance | Tool to retrieve a specific Postgres instance. Use when you need to get details about a Postgres database in your Render account. |
| `RENDER_RETRIEVE_PROJECT` | Retrieve Project | Tool to retrieve a specific project by ID. Use when you need to fetch detailed information about a Render project including its name, owner, and associated environments. |
| `RENDER_RETRIEVE_REGISTRY_CREDENTIAL` | Retrieve Registry Credential | Tool to retrieve a registry credential by ID. Use when you need to get details about a Docker registry credential in your Render account. |
| `RENDER_RETRIEVE_SECRET_FILE` | Retrieve Secret File | Tool to retrieve a secret file from a Render service. Use when you need to get the content of a specific secret file within a service. |
| `RENDER_RETRIEVE_SERVICE` | Retrieve Service | Tool to retrieve a specific service by ID. Use when you need detailed information about a service including its configuration, status, and deployment settings. |
| `RENDER_STREAM_TASK_RUNS_EVENTS` | Stream Task Runs Events | Tool to stream real-time task run events via Server-Sent Events (SSE). Use when you need to monitor task execution status and receive live updates as tasks progress. Requires maintaining an open HTTP connection to receive the event stream. |
| `RENDER_SUBSCRIBE_LOGS` | Subscribe to Logs | Tool to subscribe to real-time logs via WebSocket connection. Use when you need to stream logs as they are generated for services, databases, or other resources. Note: This endpoint requires HTTP/1.1 WebSocket upgrade (HTTP 101 Switching Protocols). For retrieving historical logs without streaming, use the List Logs action instead. |
| `RENDER_SUSPEND_SERVICE` | Suspend Service | Tool to suspend a service. Use when you need to temporarily stop a service without deleting it. |
| `RENDER_TRIGGER_DEPLOY` | Trigger Deploy | Tool to trigger a new deploy for a specified service. Requires the service to already exist on Render and be linked to a Git repo — initial setup and repo linking must be done in the Render UI. Use when you need to manually start a new build and deployment process, such as after updating service configuration or pushing code changes that Render does not auto-apply. |
| `RENDER_UPDATE_ENV_GROUP` | Update Environment Group | Tool to update an environment group's name. Use when you need to rename an existing environment group. |
| `RENDER_UPDATE_ENV_GROUP_ENV_VAR` | Update Environment Group Variable | Tool to add or update an environment variable in an environment group. Use when you need to set a new value for an environment variable or create a new one if it doesn't exist. You can either provide a specific value or request a randomly generated value. |
| `RENDER_UPDATE_ENV_GROUP_SECRET_FILE` | Update Environment Group Secret File | Tool to add or update a secret file in an environment group. Use when you need to create a new secret file or modify the content of an existing secret file within an environment group. |
| `RENDER_UPDATE_ENV_VAR` | Update Environment Variable | Tool to add or update an environment variable for a Render service. Use when you need to set a new environment variable or modify an existing one's value. You can either provide a specific value or have Render auto-generate a secure random value. |
| `RENDER_UPDATE_ENV_VARS_FOR_SERVICE` | Update Environment Variables for Service | Tool to update environment variables for a Render service. Use when you need to add, modify, or set environment variables for a service. This replaces all environment variables with the provided list. |
| `RENDER_UPDATE_HEADERS` | Update Header Rules | Tool to replace all header rules for a Render service. Use when you need to completely replace the existing set of custom HTTP headers with a new set. This operation removes all existing header rules and replaces them with the provided ones. |
| `RENDER_UPDATE_OWNER_LOG_STREAM` | Update Owner Log Stream | Tool to update log stream configuration for an owner. Use when you need to modify log stream settings for a specific workspace. |
| `RENDER_UPDATE_OWNER_NOTIFICATION_SETTINGS` | Update Owner Notification Settings | Tool to update notification settings for a specific owner (workspace). Use when you need to modify email, preview, or notification type settings. |
| `RENDER_UPDATE_POSTGRES` | Update Postgres Instance | Tool to update a Postgres instance configuration. Use when you need to modify settings like name, plan, disk size, high availability, or IP allowlist for an existing Render Postgres database. |
| `RENDER_UPDATE_PROJECT` | Update Project | Tool to update a project's name. Use when you need to rename an existing Render project. |
| `RENDER_UPDATE_REGISTRY_CREDENTIAL` | Update Registry Credential | Tool to update a registry credential. Use when you need to modify the name, username, authentication token, or registry type for an existing Docker registry credential in your Render account. |
| `RENDER_UPDATE_RESOURCE_LOG_STREAM` | Update Resource Log Stream | Tool to update log stream override for a resource. Use when you need to configure whether logs should be sent to a custom endpoint or dropped for a specific resource (server, cron job, postgres, or redis). |
| `RENDER_UPDATE_ROUTES` | Update Routes | Tool to update redirect/rewrite rules for a service. Use when you need to set or replace the routing configuration for a Render service. This operation replaces all existing routes with the provided list. |
| `RENDER_UPDATE_SECRET_FILES_FOR_SERVICE` | Update Secret Files for Service | Tool to update secret files for a Render service. Use when you need to create or update multiple secret files at once for a specific service. |
| `RENDER_UPDATE_SERVICE` | Update Service | Tool to update a service configuration. Use when you need to modify service settings such as auto-deploy, branch, build filters, Docker image, name, repository, or service-specific details. |
| `RENDER_VERIFY_CUSTOM_DOMAIN` | Verify Custom Domain | Tool to verify DNS configuration for a custom domain. Use when you need to trigger DNS verification for a custom domain associated with a Render service. |

## Supported Triggers

None listed.

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

The Render MCP server is an implementation of the Model Context Protocol that connects your AI agent to Render. It provides structured and secure access so your agent can perform Render 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 Render
- 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 Render
- MCPServerStreamableHTTP connects to the Render 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 Render 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 Render
    composio = Composio(api_key=api_key)
    session = composio.create(
        user_id=user_id,
        toolkits=["render"],
    )
    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 Render endpoint
- The agent uses GPT-5 to interpret user commands and perform Render operations
- The instructions field defines the agent's role and behavior
```python
# Attach the MCP server to a Pydantic AI Agent
render_mcp = MCPServerStreamableHTTP(url, headers={"x-api-key": COMPOSIO_API_KEY})
agent = Agent(
    "openai:gpt-5",
    toolsets=[render_mcp],
    instructions=(
        "You are a Render assistant. Use Render 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
- Render 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 Render.\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 Render
    composio = Composio(api_key=api_key)
    session = composio.create(
        user_id=user_id,
        toolkits=["render"],
    )
    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
    render_mcp = MCPServerStreamableHTTP(url, headers={"x-api-key": COMPOSIO_API_KEY})
    agent = Agent(
        "openai:gpt-5",
        toolsets=[render_mcp],
        instructions=(
            "You are a Render assistant. Use Render 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 Render.\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 Render through Composio's Tool Router. With this setup, your agent can perform real Render 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 + Render 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 Render MCP Agent with another framework

- [ChatGPT](https://composio.dev/toolkits/render/framework/chatgpt)
- [OpenAI Agents SDK](https://composio.dev/toolkits/render/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/render/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/render/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/render/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/render/framework/codex)
- [Cursor](https://composio.dev/toolkits/render/framework/cursor)
- [VS Code](https://composio.dev/toolkits/render/framework/vscode)
- [OpenCode](https://composio.dev/toolkits/render/framework/opencode)
- [OpenClaw](https://composio.dev/toolkits/render/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/render/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/render/framework/cli)
- [Google ADK](https://composio.dev/toolkits/render/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/render/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/render/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/render/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/render/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/render/framework/crew-ai)

## Related Toolkits

- [Supabase](https://composio.dev/toolkits/supabase) - Supabase is an open-source backend platform offering scalable Postgres databases, authentication, storage, and real-time APIs. It lets developers build modern apps without managing infrastructure.
- [Codeinterpreter](https://composio.dev/toolkits/codeinterpreter) - Codeinterpreter is a Python-based coding environment with built-in data analysis and visualization. It lets you instantly run scripts, plot results, and prototype solutions inside supported platforms.
- [GitHub](https://composio.dev/toolkits/github) - GitHub is a code hosting platform for version control and collaborative software development. It streamlines project management, code review, and team workflows in one place.
- [Ably](https://composio.dev/toolkits/ably) - Ably is a real-time messaging platform for live chat and data sync in modern apps. It offers global scale and rock-solid reliability for seamless, instant experiences.
- [Abuselpdb](https://composio.dev/toolkits/abuselpdb) - Abuselpdb is a central database for reporting and checking IPs linked to malicious online activity. Use it to quickly identify and report suspicious or abusive IP addresses.
- [Alchemy](https://composio.dev/toolkits/alchemy) - Alchemy is a blockchain development platform offering APIs and tools for Ethereum apps. It simplifies building and scaling Web3 projects with robust infrastructure.
- [Algolia](https://composio.dev/toolkits/algolia) - Algolia is a hosted search API that powers lightning-fast, relevant search experiences for web and mobile apps. It helps developers deliver instant, typo-tolerant, and scalable search without complex infrastructure.
- [Anchor browser](https://composio.dev/toolkits/anchor_browser) - Anchor browser is a developer platform for AI-powered web automation. It transforms complex browser actions into easy API endpoints for streamlined web interaction.
- [Apiflash](https://composio.dev/toolkits/apiflash) - Apiflash is a website screenshot API for programmatically capturing web pages. It delivers high-quality screenshots on demand for automation, monitoring, or reporting.
- [Apiverve](https://composio.dev/toolkits/apiverve) - Apiverve delivers a suite of powerful APIs that simplify integration for developers. It's designed for reliability and scalability so you can build faster, smarter applications without the integration headache.
- [Appcircle](https://composio.dev/toolkits/appcircle) - Appcircle is an enterprise-grade mobile CI/CD platform for building, testing, and publishing mobile apps. It streamlines mobile DevOps so teams ship faster and with more confidence.
- [Appdrag](https://composio.dev/toolkits/appdrag) - Appdrag is a cloud platform for building websites, APIs, and databases with drag-and-drop tools and code editing. It accelerates development and iteration by combining hosting, database management, and low-code features in one place.
- [Appveyor](https://composio.dev/toolkits/appveyor) - AppVeyor is a cloud-based continuous integration service for building, testing, and deploying applications. It helps developers automate and streamline their software delivery pipelines.
- [Backendless](https://composio.dev/toolkits/backendless) - Backendless is a backend-as-a-service platform for mobile and web apps, offering database, file storage, user authentication, and APIs. It helps developers ship scalable applications faster without managing server infrastructure.
- [Baserow](https://composio.dev/toolkits/baserow) - Baserow is an open-source no-code database platform for building collaborative data apps. It makes it easy for teams to organize data and automate workflows without writing code.
- [Bench](https://composio.dev/toolkits/bench) - Bench is a benchmarking tool for automated performance measurement and analysis. It helps you quickly evaluate, compare, and track your systems or workflows.
- [Better stack](https://composio.dev/toolkits/better_stack) - Better Stack is a monitoring, logging, and incident management solution for apps and services. It helps teams ensure application reliability and performance with real-time insights.
- [Bitbucket](https://composio.dev/toolkits/bitbucket) - Bitbucket is a Git-based code hosting and collaboration platform for teams. It enables secure repository management and streamlined code reviews.
- [Blazemeter](https://composio.dev/toolkits/blazemeter) - Blazemeter is a continuous testing platform for web and mobile app performance. It empowers teams to automate and analyze large-scale tests with ease.
- [Blocknative](https://composio.dev/toolkits/blocknative) - Blocknative delivers real-time mempool monitoring and transaction management for public blockchains. Instantly track pending transactions and optimize blockchain interactions with live data.

## Frequently Asked Questions

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

With a standalone Render MCP server, the agents and LLMs can only access a fixed set of Render tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Render 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 Render tools.

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

Yes, absolutely. You can configure which Render 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 Render data and credentials are handled as safely as possible.

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