agents-go

Examples

Runnable examples live in examples/. Each is a standalone main package:

export OPENAI_API_KEY=sk-...
go run ./examples/hello
Example Shows
examples/hello The minimal agent: provider, instructions, one Run
examples/tools Typed function tools via NewFunctionTool
examples/handoffs A triage agent delegating to specialists with HandoffTo
examples/streaming Consuming RunStreamed events with range
examples/hitl Human-in-the-loop: interrupt, approve/reject, resume
examples/sandbox An agent that writes and runs code in a local sandbox
sandbox/docker/example The Docker sandbox backend (separate module)

The test suites are also worth reading as usage references — agents/run_test.go shows how to script a fake model (Agent.ModelImpl) for offline tests of your own agents.