Repository navigation
expert team
Expert-team mode is Sherry's second product mode: you talk to a host, the host decomposes the request and dispatches it to registered experts, each a full-stack Sherry agent. The host coordinates and synthesizes; experts do the work.
A single main agent is one model with one persona. A team adds a coordinator that can fan a request out to several specialists — each with its own persona, model, skills and MCP servers — then merge their results. The value is division of labour plus the existing TaskFlow evidence gate across experts.
Mode 1 (direct chat) is unchanged: a session only gains a host persona when it is explicitly bound to a team.
Three layers, all additive to the existing agent:
user -> host session (coordinator persona via TEAM_HOST_PROMPT)
-> TaskFlow host flow (steps carry expert=name)
-> taskflow_dispatch -> _resolve_expert -> specialist subagent
-> wait_all -> resume -> finish -> host synthesizes
The expert registry (APP_HOME/experts/*.json) is the single source of truth; teams reference experts by name so one definition serves many teams.
- A team session is created by binding a session to a team.
- The user's request lands in the host session, whose system prompt carries the coordinator overlay.
- The host creates a TaskFlow with one step per assignment, naming an
expertfrom the roster. -
taskflow_dispatchresolves each expert's persona/skills/model/timeout/goal_max_turns and spawns a subagent (SUBAGENT lane, parallel). -
taskflow_wait_allblocks until all steps settle; the host resumes the flow with their results and finishes it (evidence gate + PTC/LDW single-layer compilation). - The host synthesizes one answer.
The host is a complete base agent with a coordination persona — it does not do a member's work. The persona is opt-in: team_host_context() resolves DEFAULT_HOST_PROMPT (or a team's custom host string) and bind_team_session() writes it to the session's TEAM_HOST_PROMPT state key, invalidating the cached system prompt. Sessions without the key are byte-for-byte Mode 1 prompts.
An expert is a persisted entity (ExpertConfig): persona prompt, model, thinking, functional role, depth, skills, MCP servers, tool allow-list, step timeout and goal limit. A team is a roster (TeamConfig): host string, member expert names, reusable flag. team_count per expert is computed from all teams for the library UI and guards deletes.
The two-layer TaskFlow goal (host flow + an inner flow per expert) was NOT implemented, per the plan's Kill criteria. The main_only scope tag on TaskFlow tools is a non-overridable security gate: it prevents privilege escalation (memory/skill_manage/sessions_kill) and keeps the spawn-depth hard limit unbreakable. Letting subagents build nested flows would let them manage shared flow state and risk unbounded recursion / lane exhaustion. The shipped design is single-layer: the host owns the flow, experts are single-step subagents judged by CompletionJudge. Existing tests lock the invariant that TaskFlow tools are invisible to every subagent. Revisit only with a sandbox-isolated flow state that does not share the main agent's registers.
POST /teams/session {session_id, team} binds; GET /teams/session?session_id=… reads; DELETE /teams/session unbinds. Binding applies the host persona from the next turn; unbinding returns the session to plain Mode 1. The host sends work through the existing TaskFlow tools — no new dispatch protocol.
GET|POST /experts, PUT|DELETE /experts/:name, GET /experts/one; GET|POST /teams, PUT|DELETE /teams/:name, GET /teams/one, GET /teams/host-context. The client stores are live-first with a fail-open mock fallback so a packaged client without a reachable backend keeps a usable library.
EXPERTS_DIR = APP_HOME/experts and TEAMS_DIR = APP_HOME/teams are created lazily. The host persona is a per-session state key set (team_id, team_host_prompt) in the durable register; it survives restarts and is cleared on unbind. No database migration: team/expert data is JSON, step expert fields live in the TaskFlow state blob.
Backend: tests/agent/tools/test_expert_registry.py, test_team_registry.py, tests/server/trigger/http/test_expert_team_api.py, tests/workspace/test_team_host_prompt.py. Frontend: the team store, list/edit panel and locale suites. Full regression, docs gates and packaged E2E must stay green; Mode 1 and the TaskFlow/subagent suites must be unchanged.
Generated from the repository's wiki/ tree. Source