examples/

directory
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0

Directories

Path Synopsis
Command agent-approval gates a dangerous tool behind human approval: the gate pauses the run, the operator answers on the terminal, and a second Run resumes the conversation with the outcome.
Command agent-approval gates a dangerous tool behind human approval: the gate pauses the run, the operator answers on the terminal, and a second Run resumes the conversation with the outcome.
Command agent-basic runs an agent loop end to end: the model calls a typed tool, the runtime executes it and feeds the result back, and the loop ends when the model answers in plain text.
Command agent-basic runs an agent loop end to end: the model calls a typed tool, the runtime executes it and feeds the result back, and the loop ends when the model answers in plain text.
Command agent-harness demonstrates the stateful harness layer: a session persisted as a JSONL file survives process restarts, prompts reconstruct their context from the tree, and oversized history is compacted automatically.
Command agent-harness demonstrates the stateful harness layer: a session persisted as a JSONL file survives process restarts, prompts reconstruct their context from the tree, and oversized history is compacted automatically.
Command agent-stream consumes an agent run as a live event stream: model text deltas print as they arrive, and tool lifecycle events interleave in real time.
Command agent-stream consumes an agent run as a live event stream: model text deltas print as they arrive, and tool lifecycle events interleave in real time.
Command agent-subagent nests one agent inside another as a tool via agent.AsTool: the outer agent delegates research questions to an inner agent bound to its own prompt, each invocation running in an isolated session.
Command agent-subagent nests one agent inside another as a tool via agent.AsTool: the outer agent delegates research questions to an inner agent bound to its own prompt, each invocation running in an isolated session.
Command agnes-image generates and edits images with the Agnes Image API.
Command agnes-image generates and edits images with the Agnes Image API.
Command image-gen generates an image with gpt-image-2 and writes it to disk.
Command image-gen generates an image with gpt-image-2 and writes it to disk.
Command middleware shows composing a bare provider with rate limiting, retries, and observability via ai.Chain.
Command middleware shows composing a bare provider with rate limiting, retries, and observability via ai.Chain.
Command provider-switch sends one prompt through any built-in provider package while keeping the portable ai.Request unchanged.
Command provider-switch sends one prompt through any built-in provider package while keeping the portable ai.Request unchanged.
Command rerank demonstrates document reranking with the Cohere adapter and compatible services (SiliconFlow, Jina AI, Together AI, or local vLLM/TEI).
Command rerank demonstrates document reranking with the Cohere adapter and compatible services (SiliconFlow, Jina AI, Together AI, or local vLLM/TEI).
Command structured extracts typed data from free text with ai.GenerateTyped; the JSON schema is derived from the Go struct.
Command structured extracts typed data from free text with ai.GenerateTyped; the JSON schema is derived from the Go struct.
Command team-agent 演示如何使用独立 Agent Session、Continuation 和 Team 组合出一个可恢复的多 Agent 协作流程。
Command team-agent 演示如何使用独立 Agent Session、Continuation 和 Team 组合出一个可恢复的多 Agent 协作流程。
Command text-stream-anthropic streams a message from Anthropic Claude.
Command text-stream-anthropic streams a message from Anthropic Claude.
Command text-stream-gemini streams a response from Google Gemini.
Command text-stream-gemini streams a response from Google Gemini.
Command text-stream-openai streams a chat completion from OpenAI and prints tokens as they arrive.
Command text-stream-openai streams a chat completion from OpenAI and prints tokens as they arrive.
Command tools runs a complete tool-calling round trip: the model requests a tool invocation, the program executes it and returns the result, and the model produces the final answer.
Command tools runs a complete tool-calling round trip: the model requests a tool invocation, the program executes it and returns the result, and the model produces the final answer.
Command vision sends an image to a vision-capable model and asks for a description.
Command vision sends an image to a vision-capable model and asks for a description.

Jump to

Keyboard shortcuts

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