agent_with_error_control

command
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

agent_with_error_control

Demonstrates error control (WithErrorControl) — not lifecycle WithHooks:

Scenario What this example does
OnLLMFailure Stub primary returns *LLMError rate_limit; hook swaps to named client "cheap"
OnMaxIterationsExceeded MaxIterations is 1; hook grants one extra round so the run can finish
Circuit breaker Stub tool always fails with the same args; the third call is skipped

Uses stub LLM clients and a stub tool. No extra infrastructure. No provider key required.

Error-control activity is printed to stderr with an [error-control] prefix.

Run

From examples/:

go run ./agent_with_error_control

Durable runtimes

Temporal: Register the same WithNamedLLMClients and WithErrorControl on the agent starter and the worker. Fingerprinted: hook slots (not bodies), fallback name, named-client model/provider, breaker thresholds.

Restate: Hooks run in the process that serves the embedded SDK endpoint (AGENT_RUNTIME=restate).

Documentation

Overview

Example demonstrating WithErrorControl: fallback after LLM failure, one extra iteration past max-iter, and a per-tool circuit breaker.

All scenarios use stub LLM clients and a stub tool — no provider key and no extra infra. AGENT_RUNTIME=temporal or restate still works via config.RuntimeOption.

Run from examples/:

go run ./agent_with_error_control

Jump to

Keyboard shortcuts

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