Skip to main content

Arcade.dev Integration for Pydantic AI

PyPI versions license

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_id per 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

Metadata

Release files for pydantic-ai-arcade 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydantic-ai-arcade 0.2.0
File Size Uploaded
pydantic_ai_arcade-0.2.0.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-ai-arcade 0.2.0
File Interpreter ABI Platform
pydantic_ai_arcade-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / pydantic_ai_arcade-0.2.0.tar.gz

Download URL pydantic_ai_arcade-0.2.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
428e6e049d4b55787ef9e289d795242b1d1772112814af0be7d39191335c9e76
BLAKE2b-256 checksum
How to use checksums
d41ce4193d07e17e881bfaf4b2c18f6c3bacc45c432baab18489784fdf71d9bb
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / pydantic_ai_arcade-0.2.0-py3-none-any.whl

Download URL pydantic_ai_arcade-0.2.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20e5c15f40397687932a04e5c9e72fb2d9880f076455e9ea92564d60e0692e7b
BLAKE2b-256 checksum
How to use checksums
b3168a392948343a22229d8d3dce0aa53cf988bd670170e85a7d78029e639a4b
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page