HridaSpro Docs

Integrations

OpenAI Agents SDK

Build agents with the OpenAI Agents SDK on top of Spro — every provider, guardrails, and traces included.

The OpenAI Agents SDK works with Spro out of the box — point its client at Spro and your agents get every provider, plus guardrails and trace observability, for free.

Setup

Install the SDK:

pip install openai-agents

Here's a complete, runnable agent that answers questions about the weather using a tool:

import asynciofrom openai import AsyncOpenAIfrom agents import Agent, Runner, function_tool, set_default_openai_client, set_default_openai_api, set_trace_processorsfrom agents.tracing.processors import BackendSpanExporter, BatchTraceProcessor
# Point the Agents SDK at Sproset_default_openai_client(    AsyncOpenAI(        base_url="https://spro.hridaai.com/v1",        api_key="YOUR_SPRO_API_KEY",    ))# Spro speaks the Chat Completions APIset_default_openai_api("chat_completions")# Export traces to Spro instead of OpenAI's platformset_trace_processors([    BatchTraceProcessor(        BackendSpanExporter(            endpoint="https://spro.hridaai.com/v1/traces/ingest",            api_key="YOUR_SPRO_API_KEY",        )    )])

@function_tooldef get_weather(city: str) -> str:    """Get the current weather for a city."""    # Replace with a real weather API call    return f"The weather in {city} is 22°C and sunny."

agent = Agent(    name="Weather Assistant",    instructions="You are a helpful assistant. Use the get_weather tool when asked about the weather.",    model="gpt-oss-20b",    tools=[get_weather],)

async def main():    result = await Runner.run(agent, "What's the weather in Paris and Tokyo?")    print(result.final_output)

asyncio.run(main())

The agent automatically calls get_weather where needed and answers with real tool output — while every request and tool call flows through Spro with your workspace's guardrails applied.

Traces and observability

The Agents SDK's tracing normally requires an OpenAI platform key. Spro gives you the same trace data with your Spro key: the exporter sends every span — agent runs, LLM generations, tool calls — to POST /v1/traces/ingest, and Spro stitches the generation spans to the usage logs of the gateway calls they made.

Beta

Agent trace ingestion is in beta — the exporter setup, span stitching, and dashboard views are still evolving.

That means in your Spro dashboard you can see, per trace:

  • the full span tree — which agent called which tool, and when
  • token usage and cost for every model call, rolled up under the trace
  • any errors attached to a span

Export is idempotent (span IDs are unique), so retries and replays are safe.

Note

Tracing is enabled by default in the Agents SDK — the only setup needed is pointing the exporter at Spro as shown above. If you don't want traces at all, call set_tracing_disabled(True) instead.

What's Next