docs: global architecture context for Dynamic Team Mode (RFC-0055) - #172
docs: global architecture context for Dynamic Team Mode (RFC-0055)#172Million-mo wants to merge 7 commits into
Conversation
Synchronize RFC-0055 draft so the architecture branch has the same source of truth as the implementation branch. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add README, vision/philosophy, and system overview documents that provide the high-level narrative for AgentPool architecture. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Explicitly state the problems Dynamic Team Mode solves and the hard constraints/principles that bound the solution space. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Compare multi-agent frameworks and map existing RFCs to the architectural layers and Team Mode phase plan. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Record the decision to add Dynamic Team Mode and link RFC-0055 to local session-management debt (issue #170) and codebase entry points. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive global architecture documentation for AgentPool, including its design philosophy, system overview, problem space, and a detailed draft for RFC-0055 (Dynamic Team Mode). The review feedback correctly identifies two critical issues in the RFC-0055 draft code: a missing ctx parameter in the get_tools method signature causing a NameError, and incorrect API usage of SessionPool.create_session regarding its parameters and return type. Both comments provide highly actionable code suggestions to resolve these issues.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| async def get_tools(self) -> Sequence[Tool]: | ||
| # Tools access ctx via PydanticAI's RunContext[AgentContext] at | ||
| # execution time. The toolset is constructed at capability init time | ||
| # with the config; team_id and base_dir are resolved per-operation | ||
| # from ctx.session.metadata and ctx.team_mode_config. | ||
| session_pool = ctx.host.session_pool | ||
| if session_pool is None: | ||
| return [] # standalone mode — no team tools | ||
| team_id = ctx.session.metadata.get("team_id") | ||
| if team_id is None: | ||
| return [] |
There was a problem hiding this comment.
The get_tools method uses ctx (e.g., ctx.host.session_pool and ctx.session.metadata), but ctx is not defined in the method's signature or scope. This will result in a NameError at runtime. To fix this, ctx: AgentContext should be added as a parameter to the get_tools method.
| async def get_tools(self) -> Sequence[Tool]: | |
| # Tools access ctx via PydanticAI's RunContext[AgentContext] at | |
| # execution time. The toolset is constructed at capability init time | |
| # with the config; team_id and base_dir are resolved per-operation | |
| # from ctx.session.metadata and ctx.team_mode_config. | |
| session_pool = ctx.host.session_pool | |
| if session_pool is None: | |
| return [] # standalone mode — no team tools | |
| team_id = ctx.session.metadata.get("team_id") | |
| if team_id is None: | |
| return [] | |
| async def get_tools(self, ctx: AgentContext) -> Sequence[Tool]: | |
| # Tools access ctx via PydanticAI's RunContext[AgentContext] at | |
| # execution time. The toolset is constructed at capability init time | |
| # with the config; team_id and base_dir are resolved per-operation | |
| # from ctx.session.metadata and ctx.team_mode_config. | |
| session_pool = ctx.host.session_pool | |
| if session_pool is None: | |
| return [] # standalone mode — no team tools | |
| team_id = ctx.session.metadata.get("team_id") | |
| if team_id is None: | |
| return [] |
| child_session_id = await session_pool.create_session( | ||
| agent_name=agent_name, | ||
| parent_session_id=parent_session_id, | ||
| team_id=team_id, | ||
| team_role="member", | ||
| team_member_name=member_name, | ||
| ) | ||
| # Render the protocol template for this member | ||
| protocol_prompt = config.protocol_template.format( | ||
| team_name=name, | ||
| role="member", | ||
| member_name=member_name, | ||
| ) | ||
| # protocol_prompt is the rendered protocol_template with variables | ||
| # (team_name, role, member_name) substituted. | ||
| # Start agent with protocol prompt via send_message (RFC-0054 API) | ||
| await session_pool.send_message(child_session_id, protocol_prompt, mode=DeliveryMode.QUEUE) | ||
| state.register_member(member_name, child_session_id) |
There was a problem hiding this comment.
There are two correctness issues in this block:
SessionPool.create_sessionrequiressession_idas its first parameter, but it is omitted here. This will raise aTypeErrorat runtime.create_sessionreturns aSessionStateobject, not a string ID. Assigning it tochild_session_idand passing it directly tosend_messageandregister_memberwill cause type mismatches.
To fix these, we should generate a unique session_id (e.g., child_sid), pass it to create_session, and then use child_session.session_id for subsequent calls.
| child_session_id = await session_pool.create_session( | |
| agent_name=agent_name, | |
| parent_session_id=parent_session_id, | |
| team_id=team_id, | |
| team_role="member", | |
| team_member_name=member_name, | |
| ) | |
| # Render the protocol template for this member | |
| protocol_prompt = config.protocol_template.format( | |
| team_name=name, | |
| role="member", | |
| member_name=member_name, | |
| ) | |
| # protocol_prompt is the rendered protocol_template with variables | |
| # (team_name, role, member_name) substituted. | |
| # Start agent with protocol prompt via send_message (RFC-0054 API) | |
| await session_pool.send_message(child_session_id, protocol_prompt, mode=DeliveryMode.QUEUE) | |
| state.register_member(member_name, child_session_id) | |
| child_sid = str(uuid4()) | |
| child_session = await session_pool.create_session( | |
| session_id=child_sid, | |
| agent_name=agent_name, | |
| parent_session_id=parent_session_id, | |
| team_id=team_id, | |
| team_role="member", | |
| team_member_name=member_name, | |
| ) | |
| # Render the protocol template for this member | |
| protocol_prompt = config.protocol_template.format( | |
| team_name=name, | |
| role="member", | |
| member_name=member_name, | |
| ) | |
| # protocol_prompt is the rendered protocol_template with variables | |
| # (team_name, role, member_name) substituted. | |
| # Start agent with protocol prompt via send_message (RFC-0054 API) | |
| await session_pool.send_message(child_session.session_id, protocol_prompt, mode=DeliveryMode.QUEUE) | |
| state.register_member(member_name, child_session.session_id) |
Add 07-team-mode-design-space.md with the full design-space matrix, collaboration modes, communication patterns, lifecycle, and message handling strategies. Update README navigation. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add 08-agent-abstraction-unification.md showing that agent types are relationships and lifecycle policies, not separate classes. Update README navigation. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
docs: global architecture context for Dynamic Team Mode (RFC-0055)
Purpose
This PR does not change any code. It adds global architecture documentation so that the design intent behind Dynamic Team Mode (RFC-0055) and the surrounding AgentPool architecture can be reviewed as a coherent whole, not just through scattered code PRs and discussion comments.
Related:
What is added
docs/architecture/README.mddocs/architecture/01-vision-and-philosophy.mddocs/architecture/02-system-overview.mddocs/architecture/03-problem-space.mddocs/architecture/04-constraints-and-principles.mddocs/architecture/05-framework-comparison.mddocs/architecture/06-rfc-roadmap.mddocs/architecture/06-decisions/DDR-001-why-dynamic-team-mode.mddocs/rfcs/draft/RFC-0055-dynamic-team-mode.mdfeat/dynamic-team-modedocs/team-mode/RFC-0055-design-notes.mdWhy this matters
The current RFC and implementation are spread across
feat/dynamic-team-modeand discussion comments. This branch consolidates the reasoning so that reviewers can challenge the architecture before more implementation PRs are merged.Review focus
03-problem-space.mdaccurate?04-constraints-and-principles.mdacceptable?05-framework-comparison.mdfairly represent each option?06-rfc-roadmap.mdcorrect?RFC-0055-design-notes.md?Status
Draft. Ready for architectural review and discussion.