[pull] main from anthropics:main#89
Merged
Merged
Conversation
A guided tutorial showing how to give a Managed Agent a memory store so it learns and recalls a customer's shopping preferences across separate sessions. Covers store creation, the resources attachment with per-attachment instructions, inspecting and seeding memories from your own application, and combining a per-customer read-write store with a brand-wide read-only store. https://claude.ai/code/session_01VkfVPdiJTWVh6Vj5owqRXH
- Prefer uv add over pip in the prerequisites - Clarify that the agent_toolset_20260401 type string identifies the toolset, not a model, and does not need bumping - Drop unused reply variable from the second run_turn call Intentionally skip the dotenv suggestion: the other managed_agents notebooks set up the client without load_dotenv, so adding it here would be the inconsistent choice. https://claude.ai/code/session_01VkfVPdiJTWVh6Vj5owqRXH
- Guard the session.status_idle break on stop_reason.type == "end_turn" so the pattern is safe to copy into custom-tool agents - Import wait_for_idle_status from utilities and call it before each sessions.archive() to absorb the SSE-vs-status race - Use environments.archive instead of environments.delete - Define MODEL via the COOKBOOK_MODEL env var like the other CMA notebooks and pass it to agents.create - Seed cell: capture the return, print the seeded path, and note that it must run before the cleanup cell that deletes the store https://claude.ai/code/session_01VkfVPdiJTWVh6Vj5owqRXH
- run_turn: handle session.status_terminated and call wait_for_idle_status before returning, mirroring utilities.stream_until_end_turn; drop the now-redundant wait_for_idle_status calls from the cleanup cell - environments.create: pass an explicit cloud/limited config - agent_toolset_20260401: include the default_config block with permission_policy always_allow, matching every other CMA notebook - Seed section: explain that production seeding happens before any sessions, and add the cell's stdout so it doesn't look un-run Not changed: the end_turn-guarded idle break stays as-is. Reverting it to an unconditional break would undo the previous round's fix and diverge from utilities.stream_until_end_turn. https://claude.ai/code/session_01VkfVPdiJTWVh6Vj5owqRXH
…ookbook
Pass agent={"type": "agent", "id": agent.id, "version": agent.version}
instead of the bare agent.id, matching every other notebook in the
managed_agents series.
https://claude.ai/code/session_01VkfVPdiJTWVh6Vj5owqRXH
The illustrative markdown snippet under "Combine per-customer and shared stores" still passed agent=agent.id while the runnable cells were already using the pinned dict form. Align the snippet so readers copying the production pattern get the same version-pinned shape. https://claude.ai/code/session_01VkfVPdiJTWVh6Vj5owqRXH
- Add wait_for_idle_status calls before session archive in cleanup - Break out of run_turn on any status_idle, not just end_turn - Guard event.input against None in tool_use handler - Move seeding-order warning to a markdown Note callout - Add %pip install cell for minimum SDK version - Link to sibling CMA notebooks from the summary
- Simplify status_idle handler to a single unconditional break - Document run_turn return value in the docstring - Restore inline 'Optional: run before cleanup' hint in the seeding cell - Add catalog store cleanup reminder to the combine-stores snippet - Tighten registry description and intro phrasing
…r-ZRx6N feat(managed_agents): add Managed Agents Memory Cookbook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )