Tracing
any_agent.tracing.trace.AgentTrace
Bases: BaseModel
A trace that can be exported to JSON or printed to the console.
Source code in src/any_agent/tracing/trace.py
final_output = None
class-attribute
instance-attribute
Contains the final output message returned by the agent.
spans = Field(default_factory=list)
class-attribute
instance-attribute
A list of AgentSpan
that form the trace.
get_total_cost()
Return the current total cost and token usage statistics.
Source code in src/any_agent/tracing/trace.py
any_agent.tracing.trace.AgentSpan
Bases: BaseModel
A span that can be exported to JSON or printed to the console.
Source code in src/any_agent/tracing/trace.py
add_cost_info()
Extend attributes with TokenUseAndCost
.
from_readable_span(readable_span)
classmethod
Create an AgentSpan from a ReadableSpan.
Source code in src/any_agent/tracing/trace.py
set_attributes(attributes)
Set attributes for the span.