USMAN’S INSIGHTS
AI ARCHITECT
⌘F
HomeAll BooksAI Agent Book
HomeAI Agent BookFoundations
PreviousTools and Capability BoundariesNextRetrieval, Grounding, and Citations
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

10 sections

Progress0%
1 / 10

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

State, Memory, and Sessions

Conversation history is what the model has seen; run state is what the workflow is doing; business truth is what authoritative systems know; memory is selected information retained for later; and a session is a provider or application container that connects turns. Reliable agents model these separately instead of calling everything “memory.”

What will you be able to do?

You will choose where each kind of state lives, design a resumable checkpoint, and prevent stale conversation text from overriding authoritative data.

What is the mental model?

State kindExampleAuthorityRetention
Conversation“The user said order 42”evidence, not truthshort/compacted
Runpending approval, attempt 2harnessrun lifecycle
Businessorder 42 is shippedsystem of recordbusiness policy
Memoryuser prefers email summariesvalidated profile storeexplicit lifecycle
Sessionprovider continuation IDruntime referenceconversation lifecycle

When a user says “my order is unshipped,” the agent should retrieve current order state. Prior text does not rewrite the ledger.

What belongs in a checkpoint?

json
{ "run_id": "run_123", "version": 3, "status": "waiting_for_approval", "provider": {"name": "openai", "resume_ref": "opaque-reference"}, "instruction_version": "support-triage@7", "budget": {"turns_used": 3, "tool_calls_used": 2}, "pending": {"proposal_id": "p_9", "tool": "apply_ticket_update"}, "tool_attempts": [{"idempotency_key": "run_123:p_9", "status": "not_started"}], "context_manifest": ["ticket:T-100:v4", "kb:refunds:v7"], "last_event_seq": 17 }

Encrypt sensitive state, sign or integrity-check it where appropriate, and treat provider references as opaque. Do not serialize live database clients or secrets.

How should memory be written?

Memory writes are side effects. Require provenance, purpose, confidence or validation, tenant/user scope, expiry, and a deletion path. Prefer explicit facts over generated summaries when possible.

text
Fact: preferred_contact_channel=email Source: user setting change event 8841 Scope: user u_17 in tenant acme Valid from: 2026-07-31 Expires: null

Do not store an agent’s guess that “the user is probably angry” as durable profile data.

How do you prove resume is correct?

  1. Pause before a mutation.
  2. Persist checkpoint and event sequence.
  3. Terminate the process.
  4. Resume in a new worker.
  5. Re-evaluate current policy and approval validity.
  6. Execute once with the stored idempotency key.
  7. Confirm budgets continue rather than reset.

Failure injection: Change the ticket in the system of record while a run waits for approval. Resume must detect the stale proposal and require recomputation or reapproval.

What mistakes should you avoid?

  • Using chat history as a database.
  • Resetting budgets when a worker restarts.
  • Persisting secrets inside model-visible messages.
  • Resuming an old action without checking current business state.
  • Writing inferred personal traits as long-term memory.

Check your understanding

  1. Which store is authoritative for an order’s shipping status?
  2. Why must an approval checkpoint include budget and idempotency state?
  3. What metadata makes a memory auditable?

Expert extension

Design retention and deletion rules for all five state kinds, including how a user deletion request propagates into provider-managed sessions and redacted evaluation fixtures.

Official references

  • OpenAI: Running agents and continuation strategies
  • Claude Agent SDK sessions