feat(agents): Agent Designer Phase 3 — memory_* tools (write side)#596
Merged
Conversation
…(Phase 3) Completes the Workstream B write side: an Agent with a memory_space binding now gets memory_list / memory_read (always) and memory_write (readwrite bindings only) at invocation — Oliver can read AND write his space. - agents/builtin_tools/memory_spaces/: closure-scoped factories capturing the binding's space id + invoker identity, MemorySpaceService via asyncio.to_thread (artifact-tools pattern). Every call re-checks the grant inside the service (viewer+ read / editor+ write), so a revoked grant becomes an error tool-result mid-session, never a leak - routes.py _build_memory_tools(): appended to the extra_tools seam only when a memory binding resolved; write tool gated on access==readwrite. extra_tools agents are never cached → tools closed over user A can't be served to user B - not gated on enabled_tools: the governing capability is the Agent's binding, not the user's tool picker (same reasoning as artifact tools) - tests: tool success/permission-error/not-found matrix + seam counts (none=0, read=2, readwrite=3); 84 inference+tool tests green Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Agent Designer — Phase 3: memory_* tools (completes the D6 read+write payoff)
Builds on the merged read-side (#594). An Agent with a
memory_spacebinding now gets tools to interact with its bound space at invocation — so Oliver can read and write his Memory Space, the D6 dogfood.What's here
agents/builtin_tools/memory_spaces/— closure-scoped factories (make_memory_list_tool/make_memory_read_tool/make_memory_write_tool) that capture the binding's space id + the invoker's identity, callingMemorySpaceServiceviaasyncio.to_thread. Same pattern as the artifact/spreadsheet tools.routes.py_build_memory_tools()— appended to theextra_toolsseam, only when a memory binding resolved.memory_list+memory_readalways;memory_writeonly foraccess: readwrite.Safety (per invoker, by construction)
MemorySpaceServicere-checks the caller's grant on every call (viewer+read /editor+write), so a grant revoked mid-session becomes an error tool-result, never a leak.extra_toolsagents are never cached, so a tool closed over user A's identity can never be served to user B.enabled_toolspicker — the governing capability is the Agent's binding (same reasoning as artifact tools). Import-boundary clean (apis.sharedonly).Testing
6 tool-factory tests (success + revoked-grant + missing-entry → error tool-result) + 3 seam tests (none=0 / read=2 / readwrite=3 tools) + existing inference/chat tests unchanged + architecture boundary gate.
routes.pyimports clean.Phase 3 is now complete (code-side)
Model selection + memory index injection (#594) + these tools = the full harness resolution. The remaining step to verify Oliver live is infra: deploy Memory Spaces to the target env and flip
AGENTS_API_ENABLED/MEMORY_SPACES_ENABLEDon.🤖 Generated with Claude Code