Multi-Agent Collaboration
Avatars, group chat, and sub-agent teams.
Multi-Agent Collaboration
Use this when more than one identity must work on a task. Near group chat and Studio sub-agents are the product path. A Python script that calls AgentExecutor.run twice is just two sequential jobs — that is not a team.
Three real surfaces
| Surface | When | Mechanism |
|---|---|---|
| Near group chat | Humans talk to several avatars in one room | group_router: user-directed @ or Meta fallback |
| True delegation | A registered avatar must execute | delegate_to_avatar runs in that avatar's real session |
| Ephemeral team | Unnamed parallel workers | AgentTeamManager.spawn_subagent |
AgentTeamManager is not constructed as AgentTeamManager(agents=[...]). It needs llm_factory and a StudioSession (base_session), plus optional owner_session_id and max_concurrent_subagents (default 4).
Near group chat
- Every new group implicitly includes Meta.
@Nameroutes to that member. Unmentioned turns go to Meta unless the text clearly names a member's job.- Progress noise (received / calling tool / tool done) should collapse into one foldable card per avatar — not one bubble per tool call.
See Near Desktop and Studio.
Delegation vs spawn
Meta tools live in agenticx/runtime/meta_tools.py:
delegate_to_avatar(avatar_id, task)— find or create the avatar session, run there, inherittaskspaces/context_filesspawn_subagent(...)— team-manager worker; blocked if the name is already a registered avatarchat_with_avatar— internal Q&A without a full execution session
The Meta system prompt is rebuilt each turn with an active-subagent snapshot (_build_active_subagents_context).
A2A (library protocol)
agenticx.protocols.client.A2AClient talks to a remote A2A service. Construct it with a target AgentCard, then create and poll collaboration tasks. It is not A2AClient(); client.invoke_skill(...). Near group chat does not go through A2A.
Session isolation
Team runs are scoped by owner_session_id. Avatar history stays on that avatar's sessions. Automation sessions (automation:<task_id>) must not leak into Meta history.
Related: Orchestration, Flow, Agent runtime.