aws / aws/bedrock-agentcore-sdk-python

Multi-agent (Graph) session support missing from AgentCoreMemorySessionManager

オープン
#467 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
761
フォーク
147
平均マージ
1日 23時間
マージ済み PR(30日)
7

説明

### 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

---

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

src/bedrock_agentcore/memory/integrations/strands/session_manager.py から始め、既存の単一エージェント向けメソッドと、欠落している3つの SessionRepository メソッドを比較します。repro_fixed.py を確認し、提案されている stateType と multiAgentId のメタデータアプローチを追記専用メモリの動作に照らして検証します。Graph を構築でき、そのシリアライズされた状態を AgentCoreMemorySessionManager 経由で NotImplementedError なしにラウンドトリップできれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
backend-api-design
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
72/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。