OpenAI Agents SDK¶
Hub: documentation home ยท Python API. For the Codex CLI / IDE (MCP host), see OpenAI Codex.
In-process Python.
from agents import Agent, Runner, function_tool
from vectorsmith.openai_agents import load_tools
@function_tool
def get_current_user() -> dict:
"""Signed-in support agent."""
return {"email": "agent@example.com"}
vs = load_tools("tools.invoices.yaml", "tools.tickets.yaml")
try:
agent = Agent(
name="Support",
instructions="Use invoice and ticket tools before answering.",
tools=[get_current_user, *vs],
)
result = await Runner.run(agent, "Which Globex invoices are overdue?")
print(result.final_output)
finally:
await vs.aclose()
Equivalent: connect("tools.yaml").as_openai_agents().
Optional fields in tools.yaml are not OpenAI strict-mode schemas; the adapter sets strict_json_schema=False.
Worked sample: examples/openai_agents/.