Stop on the odds.
Set a floor on success odds, and when your agent asks before a step, Traza answers stop if the path’s best case is below it.
Traza learns which paths your agents’ runs fail on, and flags a live run heading down one.
Set up Traza Foresight for the agent in this repo. Traza Cloud's API is https://api.trazadb.com; the key is in TRAZA_API_KEY (a full key, to change fuses).
1. Export the agent's spans over OTLP/HTTP:
OTEL_EXPORTER_OTLP_ENDPOINT=https://api.trazadb.com
OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer%20$TRAZA_API_KEY"
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
Put session.id on every span and gen_ai.agent.name on the first step, and set session.outcome to success, failure or abandoned when a run ends.
2. Once runs have completed, read the agent's Fate Map: GET https://api.trazadb.com/v1/fate/map?agent=<agent name> with the header "Authorization: Bearer $TRAZA_API_KEY". Read calibration.depths[].skill before trusting a verdict.
3. Add a predictive fuse: POST https://api.trazadb.com/v1/fuses/policies with {"name": "<agent name>", "match": {"service": "<service name>"}, "limits": {"min_success_odds": 0.3}, "action": "stop"}.
4. Before each tool call, POST https://api.trazadb.com/v1/fuses/check with {"run": "<session id>", "next": {"tool": "<tool name>"}}. When it answers "verdict": "stop", skip the call and show reasons[0].
If the agent is Claude Code, use the engine's hook pack for this step instead: from a checkout of https://github.com/toshish/traza, run python3 examples/claude-code/install.py --url https://api.trazadb.com and set TRAZA_TOKEN to a read key.
Docs: https://www.trazadb.com/docs/foresight/ llm:claude-sonnet-5-5 Bash llm:claude-sonnet-5-5 Read llm:claude-sonnet-5-5 Edit llm:claude-sonnet-5-5 Bash llm:claude-sonnet-5-5
llm:claude-sonnet-5-5 Bash llm:claude-sonnet-5-5 add_issue_comment llm:claude-sonnet-5-5
llm:claude-sonnet-5-5 Agent test-investigator llm:claude-haiku-5-5 Grep llm:claude-haiku-5-5 llm:claude-sonnet-5-5 Edit llm:claude-sonnet-5-5 Bash llm:claude-sonnet-5-5
llm:claude-sonnet-5-5 Bash×3-5 stop llm:claude-sonnet-5-5
fatal fork
likely_failure Runs that took this path succeeded 3 of 40 times.
Set a floor on success odds, and when your agent asks before a step, Traza answers stop if the path’s best case is below it.
POST /v1/fuses/policies
{"name": "ci-fix", "match": {"service": "ci-fix"},
"limits": {"min_success_odds": 0.3}, "action": "stop"} Odds are counted from your own finished runs, with a 95% interval; a path with too little history gets no guess.
Send spans with a session id and an agent name; say how each run ended.