How nlpodyssey/openai-agents-go works
This is a Go SDK for constructing and running multi-agent LLM workflows, including tools, handoffs, guardrails, persistent sessions, tracing, and voice pipelines. The main path is an application invoking the agent runner, which repeatedly calls a configured model, handles tool or handoff responses, and returns final output. Workflow configuration and voice are distinct runtime entry points. The README describes broader capabilities; sampled source directly supports the voice and session wiring noted here, while some subsystem links are omitted where implementation excerpts were unavailable.
Main entry points: run_impl.go Run loop · voice_pipeline.go Voice pipeline · run.go Agent runner · models_multi_provider.go Provider selection
Components 26
Agent execution
- Agent runner
agents/run.go - Run loop
agents/run_impl.go - Agent configuration
agents/agent.go - Guardrails
agents/guardrail.go - Handoffs
agents/handoffs.go - Run result
agents/result.go
Model integration
- Model interface
agents/models_interface.go - Provider selection
agents/models_multi_provider.go - OpenAI models
agents/models_openai_responses.go - Chat completions
agents/models_openai_chatcompletions.go
Tools and extensions
- Tool implementations
agents/tool.go - MCP tools
agents/tool_mcp.go
Workflow and voice
- Workflow builder
workflowrunner/builder.go - Workflow runner
workflowrunner/runner.go - Voice pipeline
agents/voice_pipeline.go - Speech models
agents/voice_models_openai_model_provider.go
State and observability
- Session interface
memory/session.go - SQLite session
memory/sqlite_session.go - PostgreSQL session
memory/psql_session.go - Tracing
tracing/tracing.go - Trace processors
tracing/processors.go
Other components
- Application
- OpenAI API
- MCP servers
- Audio input/output
- SQL database
Connections 30
- Application → Agent runner: invokes
- Agent runner → Run loop: runs
- Run loop → Agent configuration: reads config
- Run loop → Model interface: requests response
- Model interface → Provider selection: selects provider
- Provider selection → OpenAI models: routes request
- Provider selection → Chat completions: routes request
- OpenAI models → OpenAI API: calls API
- Chat completions → OpenAI API: calls API
- Run loop → Tool implementations: dispatches calls
- Tool implementations → MCP tools: uses MCP tool
- MCP tools → MCP servers: calls server
- Run loop → Handoffs: transfers control
- Run loop → Guardrails: checks safety
- Run loop → Run result: returns output
- Application → Workflow builder: configures workflow
- Workflow builder → Workflow runner: builds workflow
- Workflow runner → Agent runner: runs agents
- Application → Voice pipeline: starts pipeline
- Voice pipeline → Speech models: creates speech models
- Voice pipeline → Audio input/output: accepts and emits
- Voice pipeline → Workflow runner: runs workflow
- Agent runner → Session interface: uses session
- Session interface → SQLite session: implemented by
- Session interface → PostgreSQL session: implemented by
- SQLite session → SQL database: reads and writes
- PostgreSQL session → SQL database: reads and writes
- Agent runner → Tracing: records execution
- Voice pipeline → Tracing: records pipeline
- Tracing → Trace processors: dispatches spans