Skip to content
Changelog

Agno traces keep the full message history on tool-heavy runs

October 23, 20261 min read

Agno's setup_tracing(), which AgentOS(tracing=True) also calls, now builds its tracer provider with SpanLimits(max_span_attributes=1024). OpenInference stores each input message on the model span as several attributes, so a run with dozens of tool calls blew past OpenTelemetry's default of 128 and lost its oldest messages first, starting with the user's prompt.

Setting OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT or OTEL_ATTRIBUTE_COUNT_LIMIT hands the limit back to OpenTelemetry. A TracerProvider your app installed itself stays untouched.

We traced an agent driven by a scripted stand-in model that calls a lookup tool 40 times, with an in-memory span exporter swapped in for the database exporter, and counted attributes on the final model span:

setup_tracing(db=db)
Agent(model=ScriptedModel(), tools=[lookup]).run("Look up 40 records.")
# Before (real output)
attributes on the final model span: 128
input messages on it: 34 of 81
user prompt kept: False
 
# Now (real output)
attributes on the final model span: 293
input messages on it: 81 of 81
user prompt kept: True
 
# Now, with OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT=200 (real output)
attributes on the final model span: 200
input messages on it: 55 of 81
user prompt kept: False

See the cookbook, and learn more about setting up tracing in the documentation.

Frequently asked questions

OpenInference writes every input message onto the model span as several attributes, and OpenTelemetry keeps 128 attributes per span by default. A run with many tool calls passed that limit, so the oldest messages, including the user prompt, were evicted.

When Agno creates the tracer provider through setup_tracing() or AgentOS(tracing=True), each span keeps up to 1,024 attributes.

Yes. Set OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT or OTEL_ATTRIBUTE_COUNT_LIMIT and Agno leaves the limit to OpenTelemetry, where the span-level variable wins over the global one.

Shipped around the same time