Skip to main content
This guide shows you how to connect your OpenAI Agents SDK agent to Caylex using Streamable HTTP transport.

Prerequisites

Installation

Full example

main.py

Step-by-step

1

Set environment variables

2

Create the MCP server connection

Use MCPServerStreamableHttp to connect to the Caylex Navigator. The params dict must include the url and headers with your API key and user email.
3

Create an agent with Caylex tools

Pass the Caylex server to your agent’s mcp_servers list. The agent automatically discovers all available tools through MCP.
4

Run the agent

Use Runner.run() to execute the agent with a user query. The agent uses Caylex tools to interact with external systems.

Dynamic user email

In a production application, the user email typically comes from your application’s authentication context rather than an environment variable:
The x-api-key stays the same for all users (it identifies your navigator instance), but the x-user-email changes per user (it determines which credentials the Navigator uses).

Further reading