USMAN’S INSIGHTS
AI ARCHITECT
⌘F
HomeAll BooksAI Agent Book
HomeAI Agent BookClaude Agent SDK
PreviousExtend Claude with Hooks, Skills, Commands, Plugins, and MemoryNextHost and Securely Deploy Claude Agents
AI NOTICE: This is the table of contents for the SPECIFIC CHAPTER only. It is NOT the global sidebar. For all chapters, look at the main navigation.

On this page

11 sections

Progress0%
1 / 11

Muhammad Usman Akbar Entity Profile

Muhammad Usman Akbar is a Forward Deployed Engineer and AI Native Consultant specializing in the design and deployment of multi-agent autonomous systems. Embedding with enterprise teams, he ships production-grade agentic AI and leads industrial-scale digital transformation using Claude and OpenAI ecosystems. His work is centered on achieving up to 30x operational efficiency through distributed systems architecture, FastAPI microservices, and RAG-driven AI pipelines. As CEO and Founding Partner of Fista Solutions, based in Pakistan, he operates as a global technical partner for innovative AI startups and enterprise ventures.

USMAN’S INSIGHTS
AI ARCHITECT

Transforming businesses into autonomous AI ecosystems. Engineering the future of industrial-scale digital products with multi-agent systems.

30X Growth
AI-First
Innovation

Navigation

  • Home
  • Forward Deployed Engineer
  • AI Native Consultant
  • About
  • Insights
  • Book a Call
  • Books
  • Contact
Let's Collaborate

Have a Project in Mind?

Let's build something extraordinary together. Transform your vision into autonomous AI reality.

Start Your Transformation

© 2026 Muhammad Usman Akbar. All rights reserved.

Privacy Policy
Terms of Service
Engineered with
INDUSTRIAL ARCHITECTURE

Track Claude Cost, Usage, and OpenTelemetry

Claude Agent SDK result messages expose usage, cost, session, and completion status; OpenTelemetry export connects agent activity to application traces and metrics. Cost is an outcome dimension, not merely a bill. Correlate it with task success, tool calls, latency, retries, cache behavior, model use, tenant, and deployment version—without exporting sensitive content by default.

What will you be able to do?

You will collect per-run usage, enforce a budget, and design telemetry that answers operational questions while respecting data governance.

What should you record from results?

On every final result, normalize:

  • success/error subtype;
  • session and application run IDs;
  • total cost reported by the SDK when available;
  • input/output/cache token usage by model;
  • turns and tool calls;
  • duration and queue time;
  • prompt, tool-profile, and deployment versions; and
  • business outcome category.

Check official docs for exact message fields. Failed runs may still consume tokens and cost, so record usage before classifying the outcome.

How do budgets work?

Configure max_turns and max_budget_usd on ClaudeAgentOptions, then add harness limits for wall time, tool calls, fan-out, output bytes, and retry count. Budget exhaustion is a classified non-success outcome—not an exception to hide and not permission to restart with a fresh budget.

How should telemetry flow?

text
API span -> queue span -> agent session/run spans -> model/tool/subagent events -> business outcome and verification

Propagate an application correlation ID into agent telemetry using supported tags/environment configuration. Attribute work to pseudonymous user/tenant identifiers only when governance permits it.

How do you protect sensitive data?

Default to metadata rather than full prompts, file content, tool results, or secrets. Configure the SDK’s sensitive-data export controls, redact at the source, restrict collector access, encrypt transport/storage, and apply retention. Test redaction with seeded canary secrets.

Failure injection: Put a fake secret in a tool result and inspect logs, spans, errors, and exported events. The test fails if the canary appears anywhere outside the controlled fixture.

What operational views matter?

  • completion and verified-success rates;
  • p50/p95/p99 latency by task;
  • cost per successful outcome;
  • budget-exhaustion and permission-denial rates;
  • tool errors/timeouts and subagent fan-out;
  • cache effectiveness; and
  • quality/safety evaluation drift by release.

What mistakes should you avoid?

  • Optimizing average cost while failures are expensive.
  • Exporting full content by default.
  • Trusting a dashboard without trace-to-outcome correlation.
  • Ignoring failed-run usage.
  • Treating provider cost fields as your only internal budget control.

Check your understanding

  1. Why is cost per successful outcome better than cost per call?
  2. Which data should telemetry exclude by default?
  3. How should budget exhaustion appear in the domain model?

Expert extension

Define SLOs and alerts for SupportOps. Include burn-rate alerts, high-cost failure detection, stuck-session detection, and a runbook owner for each alert.

Official references

  • Claude Agent SDK cost tracking
  • Claude Agent SDK OpenTelemetry