Dominik Walczyna

Observability for AI agents on Amazon EKS: two OpenTelemetry patterns

A 200 OK says nothing about whether an agent reasoned well or stayed on budget. Notes on AWS's two OpenTelemetry patterns for tracing AI agents on EKS.

Classic monitoring answers one question: is the service up? For an AI agent that’s the easy part. The endpoint can return 200 OK while the agent picked the wrong tool, looped through five model calls instead of one, or quietly tripled the cost of a request. A recent post on the AWS Containers Blog shows how to make that behaviour visible on Amazon EKS using OpenTelemetry. Below is my summary of it and what I’d take away for a platform team.

What actually needs to be observed

The authors break agent observability into four signals:

  • LLM calls - which model was invoked, input and output tokens, cost and latency.
  • Tool calls - which tools the agent chose, with inputs, outputs and success or failure.
  • Reasoning chain - the multi-step path from the user’s question to the answer.
  • Cost attribution - token spend per agent and per request, mapped to model, Region and caller.

The important observation is that agent execution isn’t deterministic. Ask the same question twice and the agent may pick other tools, use more or fewer tokens and cost a different amount. Request-rate and error-rate dashboards alone can’t show that.

The stack

The reference implementation runs everything as Kubernetes Deployments on EKS Auto Mode, delivered with ArgoCD:

  • agents written with the Strands Agents SDK (Python), which has OpenTelemetry instrumentation built in,
  • models on Amazon Bedrock,
  • Bifrost as an OpenAI-compatible LLM gateway in front of Bedrock - it handles fallback to a smaller model when the main one is throttled and emits its own spans with token and cost data,
  • Langfuse as the backend that stores traces, tracks cost and analyses prompts,
  • an OpenTelemetry Collector in one of the two patterns.

Everything talks OTLP and uses the OpenTelemetry GenAI semantic conventions - attributes such as gen_ai.request.model, gen_ai.operation.name and gen_ai.usage.input_tokens / gen_ai.usage.output_tokens - plus a few custom ones like agent.name for filtering and per-agent cost roll-ups.

Pattern 1: decentralized

Each agent exports traces straight to Langfuse. There’s no shared component to run, the failure domain is a single agent, and there’s very little to operate. The price is configuration sprawl: changing the backend, the sampling rate or an attribute means redeploying every agent. It fits a handful of agents, or teams that own their own observability.

Pattern 2: centralized

Agents and the gateway send spans to a shared OpenTelemetry Collector, which batches, enriches, samples and filters them before forwarding to the backend. Routing and processing change in one place and agents don’t need a redeploy. The trade-off is a new shared dependency: the Collector has to be sized, monitored and made resilient, because if it fails, every agent loses telemetry at once.

The detail I like most: the agent code is identical in both patterns. Only the export endpoint differs, picked from environment variables at startup, so moving from one pattern to the other is a configuration change, not a rewrite.

A minimal Collector pipeline for the centralized variant looks roughly like this (my sketch, not the authors’ file):

receivers:
  otlp:
    protocols:
      grpc: { endpoint: 0.0.0.0:4317 }
      http: { endpoint: 0.0.0.0:4318 }
processors:
  memory_limiter: { check_interval: 1s, limit_percentage: 80 }
  batch: { timeout: 5s, send_batch_size: 256 }
exporters:
  otlphttp/langfuse:
    endpoint: https://<langfuse-host>/api/public/otel
service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [memory_limiter, batch]
      exporters: [otlphttp/langfuse]

One trace across agent, gateway and model

The end-to-end view works because of plain W3C trace context. The agent starts a root span, the HTTP client injects a traceparent header into the call to the gateway, and the gateway records the Bedrock invocation as a child span under the same trace ID. In Langfuse that becomes a single tree: request, tool calls, model calls, with tokens and cost on each step. In the authors’ test, a web-research query produced four model calls and six tool calls in one trace, with inference accounting for about 92% of the total latency - exactly the kind of insight a latency histogram on the agent’s endpoint would never give you.

Production recommendations from the post

  • Start decentralized while you have few agents; move to a Collector as the fleet grows.
  • Use tail-based sampling so slow, failed and expensive traces are always kept.
  • Redact PII in the Collector, so there’s one enforcement point instead of one per agent.
  • Capture full prompts and responses in staging; truncate or redact them in production.
  • Alert on token spend per agent or tenant, using metrics derived from spans (for example the spanmetrics connector feeding Prometheus).
  • Harden the Collector: memory limiter, retry queue, enough replicas.
  • Secure OTLP with TLS and authentication; scope credentials with EKS Pod Identity and AWS Secrets Manager.
  • Watch label cardinality when turning span attributes into metrics.

My take

From a platform engineering point of view this is the familiar observability playbook applied to a new kind of workload, and that’s a good thing. Standard OpenTelemetry conventions mean the backend stays replaceable, the Collector gives the platform team one place to enforce sampling, redaction and routing, and GitOps keeps all of it reviewable.

If I were rolling this out, I’d treat cost as a first-class signal from day one. With agents, a regression often shows up as more tokens rather than more errors, so a spend alert per agent is as important as an error-rate alert. I’d also go straight to the centralized pattern once more than one team ships agents: PII redaction and sampling policy are exactly the kind of rules that shouldn’t be reimplemented in every service.

The full implementation, including setup scripts for the EKS cluster, gateway, Langfuse and both agent variants, is in the aws-samples repository linked from the original post.