Arcade integration for Pydantic AI
Project description
Arcade.dev Integration for Pydantic AI
pydantic-ai-arcade is a lightweight integration layer that connects
Arcade.dev MCP tools with Pydantic AI,
enabling agents to securely interact with external services (Gmail, Slack, GitHub, and
more) using type-safe interfaces.
Installation
pip install pydantic-ai-arcade
Features
- Easy Integration: one call to fetch tools and wire them into Pydantic AI agents.
- Extensive Toolkits: Gmail, Google Drive, GitHub, Slack, LinkedIn, X, and more.
- Async-first: built with async/await for modern agent runtimes.
- Authorization Handling: supports Arcade MCP tools that require user consent (OAuth-style flows).
Usage
1. Set your API key
Arcade uses an API key for tool discovery and execution.
export ARCADE_API_KEY="YOUR_ARCADE_API_KEY"
2. Define a user-aware run context
Authorization is scoped per user. Provide a stable, unique user identifier (e.g., your internal user ID or email used for Arcade).
from pydantic_ai_arcade import ToolRunContext
class AgentContext(ToolRunContext):
def get_user_id(self, tool_name: str | None = None) -> str:
# Use a unique ID for each user
return "user_123"
3. Create tools and run a Pydantic AI agent
import asyncio
from arcadepy import AsyncArcade
from pydantic_ai import Agent
from pydantic_ai_arcade import get_arcade_client, get_arcade_tools
async def main() -> None:
client = AsyncArcade()
ctx = AgentContext()
tools = await get_arcade_tools(
client,
tools=["Gmail.ListEmails", "Gmail.SendEmail"],
toolkits=["Slack"],
)
# authorize the tools
for tool in tools:
result = await client.tools.authorize(tool_name=tool.name, user_id=ctx.get_user_id())
if result.status != "completed":
print(f"Click this link to authorize {tool.name}:\n{result.url}")
await client.auth.wait_for_completion(result)
# create the agent
agent = Agent(
model="gpt-4o-mini",
deps_type=AgentContext,
tools=tools,
system_prompt="You are a helpful assistant that can use Gmail and Slack tools.",
)
result = await agent.run(
"Summarize my latest 3 emails and send the summary to #general.",
deps=AgentContext(),
)
print(result.output)
if __name__ == "__main__":
asyncio.run(main())
Notes
Authorization behavior
- Tools that require user authorization will return a message containing the authorization
URL. Once the user authorizes, re-run the request with the same
user_id. - Use a consistent
user_idper user; Arcade persists authorization per tool and user.
Selecting tools and toolkits
Pick only the tools you need to keep the agent focused. You can request specific tools or entire toolkits.
tools = await get_arcade_tools(
client,
tools=["Gmail.ListEmails", "Gmail.SendEmail"],
toolkits=["Slack"],
)
Resources
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydantic_ai_arcade-0.2.0.tar.gz.
File metadata
- Download URL: pydantic_ai_arcade-0.2.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
428e6e049d4b55787ef9e289d795242b1d1772112814af0be7d39191335c9e76
|
|
| MD5 |
0b325c5eb6b6333f75f668d165efc1f9
|
|
| BLAKE2b-256 |
d41ce4193d07e17e881bfaf4b2c18f6c3bacc45c432baab18489784fdf71d9bb
|
File details
Details for the file pydantic_ai_arcade-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pydantic_ai_arcade-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20e5c15f40397687932a04e5c9e72fb2d9880f076455e9ea92564d60e0692e7b
|
|
| MD5 |
dd9460e84bc69ea6cbe8eb13c9c5343d
|
|
| BLAKE2b-256 |
b3168a392948343a22229d8d3dce0aa53cf988bd670170e85a7d78029e639a4b
|