The two outcome fields
Every trace has two optional outcome fields:| Field | Type | Description |
|---|---|---|
success | boolean | Was this run successful by your definition? |
outcome | string | An optional label describing the specific result |
outcome gives you a more granular label beyond the binary success/failure distinction. A run can be success=False with outcome="escalated" (the agent correctly recognized it couldn’t handle this one) or success=False with outcome="hallucinated" (the agent produced an incorrect answer). Those two failure modes call for very different responses.
Setting outcomes
Context manager
The most common pattern is to set the outcome at the end of awith agentvista.run(...) block:
r.set_outcome(success, outcome) accepts outcome as an optional keyword argument. If you only care about the boolean signal, you can omit it:
Record (v1 API)
If you’re usingagentvista.record() for simple single-span tracing, pass success and outcome directly:
Via the API
You can also update an outcome after the run has completed — useful when success is determined by a downstream process (for example, a human reviewing the agent’s output hours later):- A sales team confirming whether a qualified lead converted
- A support manager reviewing whether auto-resolved tickets stayed closed
- An automated test suite validating agent outputs offline
What the dashboard shows you
When you set outcomes, the AgentVista dashboard unlocks a set of views that go beyond raw trace data: Success rate chart — success rate over time for each agent. Drop after a prompt change? You’ll see it immediately. Outcome breakdown — a breakdown of how often eachoutcome label appears. If "escalated" is climbing while "resolved" is flat, something in your agent’s logic has changed.
Outcome-to-cost linking — the dashboard surfaces the average cost per run for each outcome. This answers questions like: “Are we spending more on runs that end up failing anyway?” or “Our success rate improved — but did our cost per resolved ticket also go up?”
Use case examples
- Customer support bot
- Lead qualifier
- Code reviewer
Outcomes without the decorator
If you use@agentvista.trace_agent (the decorator pattern), you don’t get a handle to call set_outcome() on. In that case, switch to the context manager pattern for any agent where outcomes matter:
Outcomes are optional on every run. Traces without
success or outcome still appear in the dashboard — they just won’t contribute to success rate charts or outcome breakdowns until those fields are populated.