Lesson 3 of 3 Integration, Zero Trust and State Components

Persisting State Across Session, Team and Long-Term Tiers

This lesson describes the three tiers of state in a multi-agent system, conversations that last minutes, workflows that wait days and memories that last months, and the policies for each, since storing all of it in one place either wastes money or loses durability.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the requirements and stores for session state.
  • Describe how shared team state is kept durable.
  • Define policies for long-term semantic memory, including tenant isolation.

Session state

Session state covers one conversation or run: messages, temporary variables and tool results. It needs low latency and expires after inactivity. Foundry Agent Service stores conversations for its agents. Custom agents use Azure Managed Redis (the successor to Azure Cache for Redis, which is being retired) for fast access with expiry, or Azure Cosmos DB items with a time-to-live (TTL) when durability across restarts matters.

The following diagram shows the three tiers of state.

The three tiers of state in a multi-agent solution. Session state covers one conversation or run and needs low latency with expiry: Foundry conversations, Azure Managed Redis or Cosmos DB items with a time-to-live. Shared team state is what several agents read and update during a workflow. Long-term semantic memory persists facts and preferences across sessions, with retrieval, retention and deletion policies.
Each tier has different latency and retention needs.
Sort into groups

Which state tier?

Exam skills 1.2.3

Place each piece of state in the tier that should hold it.

Log in to try this activity Interactive activities are free with an account.

Shared team state

Shared team state is the state of a multi-agent workflow: which steps are complete, the shared blackboard, pending approvals and intermediate results. It must be durable and consistent, because a workflow that pauses for approval must resume exactly where it stopped, possibly on another instance. Agent Framework checkpoints and LangGraph checkpointers persist this state to storage such as Cosmos DB or Azure Blob Storage; Foundry workflows persist it automatically. Concurrent writers need optimistic concurrency (ETags) or a single writer per field.

Scenario questions

Durable shared state

Exam skills 1.2.3

Choose how to persist shared workflow state safely.

Log in to try this activity Interactive activities are free with an account.

Long-term semantic memory and its policies

Long-term semantic memory holds facts, preferences and summaries with embeddings for retrieval: Foundry memory stores (preview), Azure AI Search indexes or Cosmos DB with vector search. Two kinds of policy govern it. Lifecycle policies define retention periods, TTL, consolidation of duplicates and deletion on request. Tenant-isolation policies keep each tenant's data separate: a container, database or index per tenant for strong isolation, or a tenant partition key with mandatory filters for efficient sharing.

The following table summarizes the three tiers.

TierRequirementsTypical Azure components
Session stateLow latency, expiryFoundry conversations, Azure Managed Redis, Cosmos DB with TTL
Shared team stateDurability, consistency, resumeWorkflow checkpoints in Cosmos DB or Blob Storage
Long-term semantic memoryVector retrieval, retention, isolationFoundry memory stores, AI Search, Cosmos DB vector search
Sort into groups

Lifecycle or tenant isolation?

Exam skills 1.2.3

Classify each policy for long-term memory.

Log in to try this activity Interactive activities are free with an account.
Worked example

A multi-tenant SaaS assistant

A software vendor offers an assistant to 400 business customers. Each customer's memories must never be visible to another, two large customers require physically separate storage, and workflows that wait for customer approval must survive service restarts.

Workflow checkpoints go to a durable store such as Cosmos DB. Long-term memory uses a shared store partitioned by tenant ID with filters applied by the service's code for most customers, and dedicated containers or indexes for the two large customers. Relying on instructions such as "only use this tenant's memories" would not isolate data, and in-memory session state would lose waiting workflows on restart.

Check yourself

What lets a paused workflow survive a restart?

Show answer

Workflow checkpoints, which persist its state so it can resume.

Exam Tips

Remember for the exam

  • Session state expires; team state must resume; long-term memory needs retention rules.
  • Workflow checkpoints make paused workflows survive restarts.
  • Tenant isolation: separate stores for strong isolation, partition keys plus enforced filters otherwise.