Feedback loops
An agent that starts from scratch each session repeats the same work. A feedback loop sends what the agent did and what it learned back to a source, so the next session, or another agent, starts closer to the answer.
How Stash does it
Section titled “How Stash does it”A loop has three parts:
- Capture. At the end of each turn, Stash saves the turn to a queue on disk.
- Send. Stash sends each saved turn to each source that you made writable. It keeps the turn until the source accepts it, and tries again after a failure.
- Read back. The source turns what it got into records. The next session finds those records in the mount, like any other file.
Notes take the same path. A note that the agent saves can also go to a writable source. See Local memory.
You choose where writes go
Section titled “You choose where writes go”A source is read-only until you give it a write table. That table says how Stash turns
a turn into something the source stores:
- An
agentcore-memorysource sends each prompt, reply, and tool call as an event of one actor. Amazon Bedrock AgentCore Memory strategies then make long-term records, such as summaries and facts. - A
pluginsource passes each turn to its plugin, and the plugin decides how to store it.
The same rule holds for each part of a source: its config decides what Stash reads from it, how it shows as files, and what Stash writes back. More than one source can be writable, and retention and deletion stay with each source.
With first-party sources. AgentCore Memory gives the loop the most: its strategies turn raw turns into summaries and facts, and the next session hydrates them. A plugin gets the same turns, and its own logic decides what to keep.
Try it
Section titled “Try it”Start with an AgentCore Memory that has a strategy for the records you want. Configure
AWS credentials with the
read and write permissions. Create
stash.toml, and replace REPLACE-ME with your memory ID:
mount_point = "/tmp/ops-context"harnesses = ["claude"]
[sources.incidents]kind = "agentcore-memory"arn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:memory/REPLACE-ME"auth = { sigv4 = {} }write.trajectory.actor = "ops-agent"Create and attach the mount:
stash create ops --config stash.toml --attachstash status opsRepeat stash status ops until it shows state: ready and the incidents source shows
started. Then work on INC-4412 in the attached agent and end the turn.
AgentCore Memory processes the events asynchronously. After its strategy creates a record, start another session and search for it:
stash search ops "INC-4412" --path "/agentcore-memory/incidents/*"Write-back sends the full text of each tool result, which can include a file that the agent read. Write back only to a source that may hold that data.
If a source refuses a write, the write waits on disk. Fix the cause, then send it again
with stash redrive ops.
Next steps
Section titled “Next steps”- Connect sources: make a source writable.
- Strands Agents: write turns back from a Strands app.
- Configuration reference: each write key, and the shape of each event.