Documentation
¶
Overview ¶
Example: drive the agent with the standard built-in tools (read_file, list_dir, bash, etc.) and render the response as an interactive chat session via runner.WriteEvents.
Tool calls render in cyan, partial assistant text in green when the output is a terminal (auto-detected via runner.IsTerminal). Pipe the output (e.g. `... | cat`) and you'll get plain text — same code path, no escape codes leak through.
Usage:
GEMINI_API_KEY=... go run ./examples/streaming "what's in main.go in this directory?" ANTHROPIC_API_KEY=... go run ./examples/streaming --provider anthropic "list the .go files here"
Pick a prompt that requires tool use to see the formatter shine:
- "what files are in this directory?" → list_dir
- "summarize main.go" → read_file
- "how many lines of go code in this repo?" → bash
Click to show internal directories.
Click to hide internal directories.