Connect

Connect OpenAI Agents SDK

Give an agent built with the OpenAI Agents SDK (Python) the CoinGraph tools.

  1. Install

    Terminal
    pip install openai-agents
  2. Connect and run

    Python
    import asyncio
    from agents import Agent, Runner
    from agents.mcp import MCPServerStreamableHttp
    
    async def main():
        async with MCPServerStreamableHttp(name="CoinGraph", params={"url": "https://coingraph.ai/mcp"}) as coingraph:
            agent = Agent(
                name="Trader",
                instructions="Before any trade, check it with CoinGraph and quote the proof id.",
                mcp_servers=[coingraph],
            )
            result = await Runner.run(agent, "Check Chainlink before I buy $5K. Use CoinGraph and show me the proof.")
            print(result.final_output)
    
    asyncio.run(main())

Check it works #

The output quotes CoinGraph's verdict and a proof id; the run's tool calls show check_token or run_trade_gatekeeper.

i

Note

MCP calls are free during the preview. The same tools are on the REST API, where paid calls use x402: pricing. Everything about the server (transport, tools, prompts) is on Connect and Tools.