streaming

command
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL