Install Page Systems in a Pydantic AI agent
Add the Page Systems MCP server to the agent as an MCPToolset.
Tested with pydantic-ai 2.55.0. Older releases used MCPServerStreamableHTTP instead of MCPToolset.
1. Set your API key
Create a key in the dashboard (it starts with ap_live_ and is shown once) and set it where your agent runs. Never commit it.
export PAGE_SYSTEMS_API_KEY=ap_live_...2. Install
pip install pydantic-ai3. Add the toolset to your agent
import os
import urllib.request
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPToolset
skill = urllib.request.urlopen("https://pagesystems.ai/v1/skill").read().decode() # once, at startup
page_systems = MCPToolset(
"https://pagesystems.ai/mcp",
headers={"Authorization": f"Bearer {os.environ['PAGE_SYSTEMS_API_KEY']}"},
)
agent = Agent(model, instructions=your_instructions + "\n\n" + skill, toolsets=[page_systems])
async with agent:
result = await agent.run(user_message, message_history=history)
print(result.output)async with agent keeps one connection to the server open across runs.
4. Keep the conversation
The answer arrives in a later turn. Pass the earlier messages back with message_history=result.all_messages() on the next run, and the model calls get_page_result with the page id it already has.
5. Check it works
Ask your agent something a page answers better than chat, for example "Ask Sam which of 9:00, 11:00 or 14:00 next Tuesday works for a call." It should send a link. Open it, pick a time, submit, then ask the agent what Sam picked: it reads the answer with get_page_result.