USMAN’S INSIGHTS
AI ARCHITECT
⌘F
HomeAll BooksAI Agent Book
HomeAI Agent BookProduction and Mastery
PreviousImplement OpenAI and Claude Provider AdaptersNextDeploy with Containers, Sandboxes, and Secret Boundaries
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

Build the API, Worker, and Long-Running Agent Architecture

A production agent API should admit and validate work, create a durable run, and return quickly; workers execute leased jobs, persist events and checkpoints, and publish outcomes. Clients observe through event streams or polling, submit approvals through authenticated endpoints, and fetch final artifacts separately. Long-running work must survive disconnected clients and failed processes.

What will you be able to do?

You will design the service boundaries and HTTP contracts for queued, resumable SupportOps runs.

What is the reference architecture?

Rendering diagram...

What should the API expose?

text
POST /runs create idempotent run GET /runs/{id} current projection/outcome GET /runs/{id}/events ordered stream or page POST /runs/{id}/cancel request cancellation GET /runs/{id}/approvals pending exact proposals POST /approvals/{id}/decide approve/reject with reason GET /runs/{id}/artifacts authorized artifact metadata

Return 202 Accepted for queued work and a stable run ID. Require idempotency on create. Authorize every run/artifact/approval by tenant and role.

How do workers behave?

Acquire a lease, load checkpoint and budget, start/continue the adapter, persist events before acknowledging critical transitions, heartbeat, honor cancellation, reconcile tool attempts, save checkpoints, and atomically publish terminal outcome. A worker crash must release only through lease expiry, not create a second active owner immediately.

How do clients observe?

Server-Sent Events fit one-way progress; WebSockets fit bidirectional interactive input; polling is simplest and robust. Normalize events, use sequence IDs, support reconnect, and never make a browser connection the owner of execution.

Failure injection: Close the client, kill the API, and restart a worker independently. The run should remain observable and reach one terminal outcome.

How do you prove the architecture?

Run chaos tests for duplicate create, queue redelivery, lease loss, API restart, stream reconnect, worker death, delayed approval, cancellation, and event-store outage.

What mistakes should you avoid?

  • Holding an HTTP request open for the entire agent run.
  • Storing run state only in worker memory.
  • Letting clients approve by sending arbitrary tool arguments.
  • Returning artifacts without tenant authorization.
  • Acknowledging queue jobs before durable terminal state.

Check your understanding

  1. Why should run creation return quickly?
  2. What is the lease’s purpose?
  3. Which component owns execution when the client disconnects?

Expert extension

Write an OpenAPI state model for these endpoints and a sequence diagram for create, approval pause, process restart, resume, and completion.

Further reading

  • Consult the official documentation for your selected queue, database, streaming transport, and API framework before implementation.