aws / aws/bedrock-agentcore-sdk-python

Multi-agent (Graph) session support missing from AgentCoreMemorySessionManager

Đang mở
#467 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
764
Fork
148
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
7

Mô tả

### Summary

`AgentCoreMemorySessionManager` (at
[`src/bedrock_agentcore/memory/integrations/strands/session_manager.py`](https://github.com/aws/bedrock-agentcore-sdk-python/blob/main/src/bedrock_agentcore/memory/integrations/strands/session_manager.py))
does not implement the three multi-agent methods on Strands'
`SessionRepository` interface (`create_multi_agent`,
`read_multi_agent`, `update_multi_agent`). As a result, any Strands
`Graph` that uses `AgentCoreMemorySessionManager` fails at graph
build time with `NotImplementedError`, before any AWS API call is
even attempted.

The single-agent methods (`create_agent`, `read_agent`,
`update_agent`, etc.) are fully implemented. The gap is only in the
multi-agent methods, which were added to `SessionRepository`
upstream and default to raising.

### Impact

Any workflow that wants Graph-level session persistence with
AgentCore Memory is blocked. Examples:

- Classifier-routed multi-agent graphs (the Strands docs' own
[Interactive Customer Support](https://strandsagents.com/docs/user-guide/concepts/multi-agent/multi-agent-patterns/)
canonical Graph example)
- Workflows that use Strands interrupts for human-in-the-loop
steps, which require Graph nodes because the Agents-as-Tools
pattern swallows interrupts

### Reproduction

Minimal repro repo: https://github.com/akomandooru/agentcore-graph-repro/

Two scripts, broken and fixed, both using the real
`AgentCoreMemorySessionManager` from this SDK:

- `repro_broken.py` constructs `AgentCoreMemorySessionManager`,
attaches it to a two-node `GraphBuilder`, and calls `.build()`.
Fails with `NotImplementedError: MultiAgent is not implemented for
this repository`. No AWS credentials needed; the error fires before
any API call.
- `repro_fixed.py` subclasses `AgentCoreMemorySessionManager` with the
three methods and demonstrates graph state serialising and
round-tripping cleanly.

```
File ".../strands/multiagent/graph.py", line 390, in build
return Graph(nodes=self.nodes.copy(), ...)
File ".../strands/multiagent/graph.py", line 476, in __init__
run_async(lambda: self.hooks.invoke_callbacks_async(MultiAgentInitializedEvent(self)))
File ".../strands/hooks/registry.py", line 306, in invoke_callbacks_async
callback(event)
File ".../strands/session/session_manager.py", line 54, in
registry.add_callback(MultiAgentInitializedEvent, lambda event: self.initialize_multi_agent(event.source))
File ".../strands/session/repository_session_manager.py", line 332, in initialize_multi_agent
self.session_repository.create_multi_agent(self.session_id, source, **kwargs)
File ".../strands/session/session_repository.py", line 58, in create_multi_agent
raise NotImplementedError("MultiAgent is not implemented for this repository")
NotImplementedError: MultiAgent is not implemented for this repository
```

`self.session_repository` here is `AgentCoreMemorySessionManager`.
The MRO hops right past it into `SessionRepository` because the
AgentCore class doesn't override the multi-agent methods.

### Proposed fix

Add three methods to `AgentCoreMemorySessionManager`, mirroring the
single-agent pattern. Full implementation in
[`repro_fixed.py`](https://github.com/akomandooru/agentcore-graph-repro/blob/main/repro_fixed.py). ~50 lines, mostly
boilerplate matching the existing single-agent methods.

Additions beyond the method bodies:

1. New `stateType` value: `"MULTI_AGENT"` (alongside `"SESSION"`
and `"AGENT"`).
2. New metadata key `multiAgentId` (alongside `agentId`) so
multiple graphs in a session don't collide.

Payload is `json.dumps(multi_agent.serialize_state())`.
`update_multi_agent` delegates to `create_multi_agent` because
AgentCore Memory is append-only and `list_events(max_results=1)`
returns the latest by timestamp, same pattern as the existing
`update_agent`.

### Willing to contribute

Happy to open a PR with the fix if the approach (new `stateType`
value, new `multiAgentId` metadata key, append-only with max_results=1
reads) is the one you'd take. Flagging as a question first in case
there's a planned design that differs.

### Environment

- `bedrock-agentcore` 1.9.0 (latest published wheel as of
May 11, 2026; verified that the three multi-agent methods are
absent by inspecting the installed
`src/bedrock_agentcore/memory/integrations/strands/session_manager.py`,
which also matches `main`)
- `strands-agents` 1.39.0
- Python 3.13

---

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu trong src/bedrock_agentcore/memory/integrations/strands/session_manager.py và so sánh các phương thức hiện có cho tác nhân đơn với ba phương thức SessionRepository còn thiếu. Xem lại repro_fixed.py và xác minh cách tiếp cận siêu dữ liệu stateType và multiAgentId được đề xuất so với hành vi bộ nhớ chỉ nối thêm. Hoàn tất khi có thể xây dựng một Graph và trạng thái đã tuần tự hóa của nó có thể round-trip qua AgentCoreMemorySessionManager mà không gặp NotImplementedError.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
backend-api-design
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
72/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.