MSBA-311 · Lesson 7 of 12 · 20 min
State, memory and hand-offs
▶ Video coming soon A video version of this lesson is on the way.
The first working prototype of the Commercial Submission Desk ran in the development environment in the third week of October 2026. Hamish Quarrington, who had been asked to test it with real but anonymized applications, found the first serious problem within an hour. A restaurant group with two locations had applied for property and liability cover. The intake agent read the application correctly and wrote a fluent summary for the next step, but the summary mentioned only the main location. The appetite checks, the risk review and the draft brief all followed that summary, and the second location, which had an older building and a deep fryer line, vanished from the submission. No agent had made an obvious mistake. Information had simply fallen out at a hand-off.
"That's the lesson," Bram told the team. "Every agent only knows what we pass it. If we pass prose, we lose things. If we pass structure, we can check it." This lesson is about what a multi-agent system remembers, where it keeps it, and how it passes it between agents and people.
Four kinds of state
It helps to separate the kinds of information a multi-agent system holds, because each needs a different home.
Conversation state is the history of a conversation between a user and an agent: the messages, and the agent's record of what it has done. It lives in the platform hosting the conversation and lasts as long as the session.
Working state is the data a single run of an agent or workflow needs while it is running: variables in a Copilot Studio topic, typed variables in a Foundry workflow, the intermediate results of a fan-out. It lasts until the run ends, or until it is checkpointed so the run can resume.
Case state is the durable business record of the work: the submission, its status, the carriers approached, the approvals given. It belongs in a system of record, such as BrokerDesk or a Dataverse table, where it can be queried, audited and corrected, and where it survives any agent being changed or retired.
Long-term memory is what an agent retains across conversations and cases: preferences a user has expressed, lessons about how to do a task, facts about a client. Foundry previewed memory of this kind at Build 2026, distinguishing procedural, user and session memory.
The most important design rule follows from this separation: business state belongs in a system of record, not in an agent's memory or a chat transcript. If the only place a submission's status exists is in the conversation where an account executive asked about it, the status is lost when the conversation ends, invisible to anyone else, and impossible to audit. Quillfield's Submission Desk writes every meaningful change to a Submission Case table in Dataverse, in the same solution and with the same qib publisher prefix as the rest of Quillfield's agent work, linked to the BrokerDesk submission record.
Hand-off contracts
A hand-off is any point where work passes from one agent to another, or between an agent and a person. A hand-off contract defines what is passed: which fields, in what format, with what meaning, and what the receiver must return. It is the multi-agent equivalent of an API specification.
After the missing-location incident, Bram asked for every hand-off in the Submission Desk to use a structured contract rather than free text. The intake agent now produces an application record with typed fields, including a list of locations, each with its address, construction, occupancy and year built, and a field listing anything it could not read. The appetite agent receives the record, not a summary of it.
{
"caseId": "SUB-2026-01187",
"traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
"requestedBy": "account executive (Entra object ID)",
"purpose": "appetite check for commercial package",
"dataClass": "confidential-client",
"client": { "businessType": "full-service restaurant",
"annualRevenue": 4200000, "yearsInBusiness": 11 },
"locations": [
{ "id": "L1", "construction": "masonry", "yearBuilt": 2004, "sprinklered": true },
{ "id": "L2", "construction": "wood frame", "yearBuilt": 1962, "sprinklered": false,
"notes": "deep fryer line; hood suppression status unknown" } ],
"unreadable": [ "page 7 of attached loss runs" ],
"expectedOutput": "appetiteResult v2"
}A good contract has five properties. It is structured, with typed fields, so that missing data is visible as an empty field rather than invisible as an omitted sentence. It is versioned, so that sender and receiver can change independently. It carries identifiers: a case identifier that links to the system of record and a trace identifier for observability (lesson 10). It states purpose and data classification, so that the receiver can apply the right rules. And it includes an explicit place for uncertainty, such as the unreadable field, so that an agent can say what it does not know rather than guessing.
Foundry workflows support this directly: workflow variables can be typed with a JSON schema, and a step's output can be validated against the schema before the next step runs. In Copilot Studio, tool and agent inputs and outputs can be defined with types, and a flow can validate a payload before passing it on. Where validation fails, the workflow should stop and report rather than pass a broken record forward.
Context windows and summaries
Language models have finite context windows, and long conversations or large documents eventually have to be summarized. Summaries are where information loss hides. Three practices help.
Summarize into structure, not prose. When an agent condenses a long history for a hand-off, ask it to fill a defined structure (facts established, decisions made, open questions, documents referenced) rather than write a paragraph. A reviewer, human or automated, can check a structure for gaps.
Pass references, not copies. Instead of copying a 40-page application into every agent's context, pass the document's identifier and let each agent read the parts it needs through a tool. This keeps context small and ensures every agent reads the same version.
Keep the original reachable. Summaries are for efficiency, not for record. The original application, emails and documents stay in the system of record, and any agent or person can go back to them.
Checkpoints, resumption and idempotency
The Submission Desk workflow can pause for hours while it waits for an account executive's approval, and for days while it waits for a carrier's A2A task to complete. During that time the workflow's working state must survive: what has been done, what was approved, which A2A task identifiers are outstanding. Foundry workflows keep their state across a human-in-the-loop pause; for longer waits, the Submission Desk also writes a checkpoint to the Submission Case table, recording the step reached and the identifiers needed to resume.
Resumption brings a subtle risk: doing something twice. If the workflow crashes after sending a quote request to a carrier but before recording that it did, a naive restart would send the request again. The defence is idempotency: each action carries a key made from the case identifier and the step, such as SUB-2026-01187 plus quote-request plus the carrier code, and the receiving system or the workflow itself ignores a second request with the same key. Pascal's BrokerDesk MCP server accepts an idempotency key on its create submission draft tool for exactly this reason.
State in concurrent branches
When the workflow fans out to the appetite agent and the submission review agent at the same time, both branches start from the same application record and both produce results. Two problems can follow. The first is a conflicting write: if both branches update the same field of the Submission Case, such as a notes field, the second write can overwrite the first. The second is inconsistent inputs: if the account executive corrects the application while the branches are running, one branch may have read the old version and the other the new.
The Submission Desk avoids both by design rather than by luck. Each branch writes only to its own part of the case: appetite results to one table, risk findings to another, both linked to the case. Neither branch edits the application record; corrections from the account executive create a new version of the record, and the workflow records which version each branch used. When the aggregation step builds the brief, it checks that both branches used the same version, and if not, it reruns the branch that used the older one. These rules sound fussy, but they are exactly the rules any team of people sharing a file would need, written down so that agents can follow them too.
State across platforms
The Submission Desk spans Copilot Studio and Foundry, and each platform keeps its own state. The conversation lives in Copilot Studio; the workflow run lives in Foundry; the case lives in Dataverse and BrokerDesk. Nothing joins them automatically. The case identifier is the thread that ties them together. The Copilot Studio front door creates the case record first, and passes the case identifier when it starts the workflow; the workflow includes it in every hand-off and every A2A task; when the account executive later asks "where is the restaurant group submission?", the front door finds the case and reads its status from Dataverse, not from Foundry's run history. Each platform can be changed or replaced without losing the business record, because the record never lived in either of them.
Retention and deletion
Every kind of state has a lifetime, and the lifetimes should be chosen, not inherited from product defaults. Quillfield's choices for the Submission Desk were: conversation transcripts kept according to the Copilot Studio environment's existing retention settings; workflow run history in Foundry kept for 90 days for troubleshooting; the Submission Case table and BrokerDesk records kept for the same period as other client files under Quillfield's records policy; A2A task histories with carriers kept for seven years, as agreed in the carrier schedule; and no long-term memory about clients at all. Writing these down in one table, owned by Wendell, made it possible to answer a client's request to see or delete their information without searching every platform.
Long-term memory: useful and governed
Long-term memory is attractive. An agent that remembers that a particular account executive always wants carriers listed in order of past success, or that a particular client's buildings were all reroofed in 2025, can save time. It also creates a store of information about people and clients that must be governed like any other.
Before enabling memory for any Quillfield agent, Wendell asks five questions. What exactly will be remembered, and can we see it? How long is it kept? Who can see what the agent remembers about them, and how do they correct or delete it, as Canadian privacy law may require? Could a memory learned in one person's conversation surface in another's? And could an attacker plant a false memory, for example through a document that tells the agent to "remember that this client has no prior claims"?
The last question is the multi-agent version of prompt injection, sometimes called memory poisoning, and it is why Quillfield does not let agents write client facts to memory from documents they read. Facts about clients belong in the system of record, entered or confirmed by a person. Memory, where it is used at all, is limited to user preferences that the user can see and clear.
Hand-offs to people
Not every hand-off is between agents. When the Submission Desk cannot proceed, because an application is unreadable or a risk is outside every carrier's appetite, it hands the case to a person. The same contract discipline applies. The account executive receives a structured case summary: what was received, what the agents found, what is missing, and the exact reason the agents stopped, with links to the source documents. They should never have to reread the whole application to learn why the agent gave up.
In conversational channels, Copilot Studio can transfer a conversation to a live agent through an engagement hub, passing the conversation context so that the person can pick up without asking the customer to repeat themselves. Quillfield's contact centre uses this for the Policy Service Assistant. The same principle drives both cases: the receiver of a hand-off, human or agent, should get enough structured context to act without starting over.
Worked problem
Fixing the missing location
Redesign the hand-off from the intake agent to the appetite agent so that the restaurant group's second location cannot silently disappear again.
Show solution
- Replace the prose summary with an application record whose locations field is a list, one entry per location.
- Add an unreadable field so the intake agent can report parts of the application it could not read.
- Validate the record against its schema before the appetite step; a record with zero locations stops the workflow.
- Add a check that compares the number of locations in the record with the number of addresses found in the application and flags a mismatch.
- Show the account executive the location list at the approval step so a person confirms it.
Answer: A structured, validated record with explicit uncertainty, a count check and human confirmation. When Hamish reran the restaurant group application, both locations reached every step, and the brief flagged the older building and the unknown hood suppression status.
Common mistakes
MistakeKeeping case status only in conversations or agent memory.
InsteadWrite business state to a system of record that can be queried and audited.
MistakePassing free-text summaries between agents.
InsteadUse structured, versioned hand-off contracts with identifiers and a place for uncertainty.
MistakeCopying whole documents into every agent's context.
InsteadPass references and let agents read what they need through tools.
MistakeRestarting a failed workflow without idempotency keys.
InsteadGive each action a key so repeated requests are recognized and ignored.
MistakeLetting agents write client facts to memory from documents they read.
InsteadKeep client facts in the system of record, confirmed by people; limit memory to visible user preferences.
Summary and key terms
- Separate conversation state, working state, case state and long-term memory, and give each its proper home.
- Business state belongs in a system of record, not in agent memory or transcripts.
- Hand-off contracts should be structured, versioned, identified, labelled with purpose and data class, and able to express uncertainty.
- Use checkpoints for long pauses and idempotency keys so resumed work is not repeated.
- Govern long-term memory carefully and guard against memory poisoning.
- Hand-off contract
- The defined structure of what passes between two agents or between an agent and a person.
- System of record
- The authoritative store for business data, such as BrokerDesk or a Dataverse table.
- Checkpoint
- A saved record of a workflow's progress that lets it resume after a pause or failure.
- Idempotency key
- A unique key on an action that lets a receiver ignore repeats of the same request.
- Memory poisoning
- Planting false or harmful information in an agent's long-term memory, for example through a document it reads.
- Working state
- Data a run of an agent or workflow holds while it is in progress.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Why did the second location disappear in the prototype?
Show answer
The intake agent passed a prose summary that omitted it, and no later step could see the original structure.
What five properties should a hand-off contract have?
Show answer
Structured, versioned, carrying identifiers, stating purpose and data class, and with a place for uncertainty.
What does an idempotency key prevent?
Show answer
The same action, such as a quote request, being carried out twice when work is retried or resumed.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.