Skip to content
DocsDashboard

Install Page Systems in an OpenAI Agents SDK agent

Connect the agent to the Page Systems MCP server. Its tools then appear to the model next to your own: list the page types, read a schema, create a page, read the answer.

Tested with openai-agents 0.23.1 (Python) and @openai/agents 0.20.0 (TypeScript).

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. Python

pip install openai-agents
import os
import urllib.request

from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp

# The Page Systems skill: when to send a page and how to use pages well. Fetch it once at startup.
skill = urllib.request.urlopen("https://pagesystems.ai/v1/skill").read().decode()

async def main() -> None:
    async with MCPServerStreamableHttp(
        name="page-systems",
        params={
            "url": "https://pagesystems.ai/mcp",
            "headers": {"Authorization": f"Bearer {os.environ['PAGE_SYSTEMS_API_KEY']}"},
        },
        cache_tools_list=True,
    ) as page_systems:
        agent = Agent(name="Assistant", instructions=your_instructions + "\n\n" + skill, mcp_servers=[page_systems])
        result = await Runner.run(agent, user_message)
        print(result.final_output)

3. TypeScript

npm install @openai/agents
import { Agent, MCPServerStreamableHttp, run } from '@openai/agents';

const skill = await fetch('https://pagesystems.ai/v1/skill').then((r) => r.text()); // once, at startup
const pageSystems = new MCPServerStreamableHttp({
  name: 'page-systems',
  url: 'https://pagesystems.ai/mcp',
  requestInit: { headers: { Authorization: `Bearer ${process.env.PAGE_SYSTEMS_API_KEY}` } },
  cacheToolsList: true,
});
await pageSystems.connect();
try {
  const agent = new Agent({ name: 'Assistant', instructions: [yourInstructions, skill].join('\n\n'), mcpServers: [pageSystems] });
  const result = await run(agent, userMessage);
  console.log(result.finalOutput);
} finally {
  await pageSystems.close();
}

4. Keep the conversation

The answer arrives in a later turn, so pass the history back in: result.to_input_list() in Python, result.history in TypeScript, plus the new user message. The model then 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.