Concept
Memory belongs to the agent that declares it. A target agent does not see the caller’s stored values. A memory grant gives the target access to named paths for one handoff or one delegate call. A grant has two parts:pathnames the memory path.accessisreadorreadwrite. The default isread.
PASS for values the caller already holds in the conversation. See Pass specific fields between agents.
Grant the fewest paths and the lowest access that the target needs.
Minimal working example
An account router holds a customer ID that all specialists in this conversation tree share. The statement agent needs to read it. The router grants the path read-only.ON_START sets the customer ID to a fixed value as a stand-in. In your project, set it from your sign-in or lookup step.
agents/account-hub.agent.abl
agents/statement-agent.agent.abl
workflow.customer_idis persistent memory of the router, set inON_START.- The target receives it under
granted_memory.workflow.customer_id.
How it works
When the handoff runs, the runtime resolves each grant, then attaches the value to the target.- The runtime reads the source declaration in the caller. The grant path must match a declared path or the
execution_tree.namespace. - The runtime finds the value in this order: the execution tree, the caller’s current values, then the stored user or project value. If no value exists, it uses the declared default.
- The runtime attaches the value to the target under
granted_memory.<path>. The target does not need to declare the path. If a value is missing, nothing is attached for that path. - The runtime authorizes each path that has a value for the target prompt. The prompt shows these values in a “Granted Memory” section.
- When PII protection is on, the runtime tokenizes protectable values first.
- A write to a
readgrant is refused. The runtime reports the reasongranted_memory_read_only.
The same rules apply to a
DELEGATE MEMORY_GRANTS list.
Common variations
Grant stored user and session values
A route can mix kinds. The session fieldregion needs no access line. The user path is read-only.
MEMORY declarations user.preferred_language and region.
Let the target update shared memory
Usereadwrite only for execution-tree memory that the caller declares with ACCESS: readwrite. The target writes the value with a SET to granted_memory.<path>.
agents/verify-agent.agent.abl
access: readwrite.
cust-2077 is a stand-in. Set it from your verification step. A SET to a path that has a read grant is refused at run time with the reason granted_memory_read_only. The compiler does not catch it.
Grant memory to a delegate
ADELEGATE uses a MEMORY_GRANTS list on the entry.
MEMORY declaration and the Refund_Checker agent from Delegate and map the result.
Verification
- Run the validator on both files. Expect no errors and no warnings.
- Send “I need my statement.” Answer the month.
- Expect a
handofftrace event toStatement_Agent. - Open the first model call of
Statement_Agentin the trace. Expect a “Granted Memory” section that listsworkflow.customer_id. - Remove the
memory_grantsblock and repeat. Expect the section to be missing. Restore the block. - Change the access to
readwriteon a user-scoped path. Expect compile errorINVALID_HANDOFF_MEMORY_GRANT_ACCESS.
Production readiness checklist
- Every granted path is declared in the caller.
- Every grant uses
readunless the target must write. - Each
readwritegrant has a written reason and a test for the write. - The target reads or writes each granted path as
granted_memory.<path>. - The granted data fits the target’s purpose. See Minimize context for privacy and compliance.
- Tests cover a path that has a value and a path that has none.
Common mistakes
Troubleshooting
Related articles: