Skip to content
Pyrula

OpenAI Agents SDK

openai_agents_agent wraps an OpenAI Agents SDK agent as a Pyrula @agent. The SDK runs inside the turn; Pyrula owns the lifecycle and forwards SDK events into the run stream. Needs pip install openai-agents.

from pyrula.agents.integrations import openai_agents_agent
researcher = openai_agents_agent(my_sdk_agent, name="researcher")

The wrapped agent takes input and an optional context. With stream=True (the default) it runs Runner.run_streamed(...), emits each SDK event as framework:event tagged with its type, and returns the final output. Without streaming it runs Runner.run(...) and returns final_output.

Either way the final output lands in run:complete.payload["result"], so a client reading the turn gets the SDK’s answer like it would from any native agent.