Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
73a746f
fix: add span instrumentation for critical-path methods (fix-span-ins…
Leoyzen Jul 16, 2026
6f6dae3
fix: add entry-point spans to fix orphan traces in ACP path
Leoyzen Jul 16, 2026
dc311a2
fix: remove f-string templates from span names and fix missing span i…
Leoyzen Jul 16, 2026
b2b1cfd
fix: call _end() separately in safe_span to prevent Missing Span
Leoyzen Jul 16, 2026
9c2c5d9
fix: use safe_span for session.consume_run and delegation.subagent
Leoyzen Jul 16, 2026
d4fb576
fix: wrap nested async generators with aclosing() to prevent span leaks
Leoyzen Jul 16, 2026
52a2e6b
chore(deps): add filelock>=3.13 for team state file locking
Leoyzen Jul 16, 2026
5a53f89
feat(config): add TeamModeConfig model for dynamic team mode
Leoyzen Jul 16, 2026
19151e1
feat(config): add team_mode field to manifest and agent config
Leoyzen Jul 16, 2026
83a1291
feat(capabilities): add team_mode_config to AgentContext
Leoyzen Jul 16, 2026
7c1250d
feat(capabilities): add FileTeamState for file-based team persistence
Leoyzen Jul 16, 2026
34457b9
feat(capabilities): add TeamCommCapability skeleton and factory regis…
Leoyzen Jul 16, 2026
ee8bd28
feat(capabilities): implement universal team communication tools
Leoyzen Jul 16, 2026
5941a17
feat(capabilities): implement lead-only team management tools
Leoyzen Jul 16, 2026
667c66c
feat(capabilities): enforce team mode bounds at runtime
Leoyzen Jul 16, 2026
50ccb20
feat(capabilities): add TTL cleanup for expired team state
Leoyzen Jul 16, 2026
9f93aa2
feat(capabilities): implement auto_init for session-startup team crea…
Leoyzen Jul 16, 2026
ca69c52
test(integration): add team mode integration tests
Leoyzen Jul 16, 2026
b6eea3b
docs: add team mode documentation and examples
Leoyzen Jul 16, 2026
1e1a1ff
fix: resolve ruff format and mypy errors in team mode files
Leoyzen Jul 16, 2026
4a18687
fix: address PR review — hierarchical key mkdir, orphaned session cle…
Leoyzen Jul 16, 2026
d97cc1a
Merge remote-tracking branch 'origin/refactor/agentwolf_v1' into feat…
Leoyzen Jul 16, 2026
41035e7
fix: resolve CI lint and format errors in test files
Leoyzen Jul 16, 2026
5ef806b
refactor: remove auto_init, use delegation.create_child_session in te…
Leoyzen Jul 16, 2026
cc68223
Merge remote-tracking branch 'origin/refactor/agentwolf_v1' into feat…
Leoyzen Jul 17, 2026
430a4f8
refactor: rename auto_init to defaults, clean up docs and examples
Leoyzen Jul 17, 2026
d1d2fcc
fix: factory per-session TeamCommCapability not added when compile st…
Leoyzen Jul 17, 2026
7bd6365
fix: ctx parameter typed as Any instead of RunContext in team tools
Leoyzen Jul 17, 2026
3425581
fix: resolve AgentContext from PydanticAI runtime context deps.data
Leoyzen Jul 17, 2026
8f4e75b
fix: set team_role metadata in factory create_session_agent
Leoyzen Jul 17, 2026
774f5e3
fix: write team_id back to session.metadata after team_create
Leoyzen Jul 17, 2026
461d386
feat: inject agent descriptions into team mode instructions
Leoyzen Jul 17, 2026
0e0bc80
fix: auto-close member sessions when lead run terminates
Leoyzen Jul 17, 2026
7cc4a1f
test: add L2 FunctionModel flow tests for team lifecycle
Leoyzen Jul 17, 2026
a9347db
feat: role-aware tool filtering via prepare_tools + role-specific ins…
Leoyzen Jul 17, 2026
ef40b2e
fix: add create_child_session to DelegationService test stubs
Leoyzen Jul 17, 2026
f5985ab
feat: log team state directory path on team_create
Leoyzen Jul 17, 2026
cb8da3f
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 18, 2026
677a05f
fix: adapt team_session_leak test to merged session lifecycle changes
Leoyzen Jul 18, 2026
52e7a65
test: redesign team mode test strategy with L1-L4 layered architecture
Leoyzen Jul 18, 2026
d984e8a
test: migrate MagicMock tests to real pool + fix VCR cassette replay
Leoyzen Jul 18, 2026
87f68dc
fix: rewrite E2E smoke test to match existing SSE patterns
Leoyzen Jul 18, 2026
1d1f44c
fix: VCR tests fail in CI — OpenAI client needs API key at init
Leoyzen Jul 18, 2026
e8b1aa4
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 18, 2026
c15a470
fix: adapt VCR tests to PR #202 infrastructure + filter litellm requests
Leoyzen Jul 18, 2026
5a4331b
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 18, 2026
29f1499
fix: handle parametrized test names in check_cassettes.py
Leoyzen Jul 19, 2026
9a843fe
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 19, 2026
f9f8642
fix: register lead as team member + idle-based cleanup
Leoyzen Jul 19, 2026
53d078e
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 19, 2026
30412fb
feat: add team_add_member and team_remove_member tools
Leoyzen Jul 20, 2026
96a0440
feat: show team_id and state dir in team_status output
Leoyzen Jul 20, 2026
5a4cd4a
fix(opencode): handle duplicate message ID in append_message_to_sessi…
Leoyzen Jul 20, 2026
183cc31
Revert "fix(opencode): handle duplicate message ID in append_message_…
Leoyzen Jul 20, 2026
b9c3c3d
fix: team_add_member bugs — agent field, blackboard key sanitization,…
Leoyzen Jul 20, 2026
d971e51
test: tighten team_add/remove_member tests — 8 new cases, reusable he…
Leoyzen Jul 20, 2026
badb8c1
fix: ghost member on send_message + shutdown_request marks member off…
Leoyzen Jul 20, 2026
0fd3265
fix: BUG-001 team_status missing dynamic members + NOTE-001 delete_bl…
Leoyzen Jul 20, 2026
3c4d813
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 20, 2026
331cf14
fix: task_update with invalid task_id returns friendly error
Leoyzen Jul 20, 2026
ec8d706
fix: allow load_session for closed sessions (history replay)
Leoyzen Jul 20, 2026
0bd1dd4
refactor: team tools return XML-wrapped content instead of JSON
Leoyzen Jul 20, 2026
b0471ca
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 21, 2026
a2eadb9
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 21, 2026
c6b6251
feat: team tools return pydantic-ai ToolReturn, add source="team" for…
Leoyzen Jul 21, 2026
f5a9379
feat: team member awareness + team_status runtime state + task associ…
Leoyzen Jul 22, 2026
225e1be
refactor: merge broadcast_notice into notify parameter for team_add_m…
Leoyzen Jul 22, 2026
11fc62f
feat: reuse agent display_name for team member names
Leoyzen Jul 22, 2026
6d472d5
fix: propagate team member name to agent display_name
Leoyzen Jul 22, 2026
be21040
refactor: shorten task_id and team_id to 8-char hex prefix
Leoyzen Jul 22, 2026
857a44e
refactor: team message XML wrapper in body, remove protocol handler p…
Leoyzen Jul 22, 2026
7f8ba38
refactor: use English for all team message templates
Leoyzen Jul 22, 2026
8a0d1f7
style: wrap member names, agent names, and roles in backticks
Leoyzen Jul 22, 2026
3373b65
feat: restrict task_create to lead-only
Leoyzen Jul 22, 2026
54d25c6
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 22, 2026
3533348
refactor: remove urgent param, use notice_delivery_mode config, clean…
Leoyzen Jul 22, 2026
2361955
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 22, 2026
3fc6cbe
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 22, 2026
095eadb
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 22, 2026
ee74c21
feat: write_blackboard append mode + value format description
Leoyzen Jul 22, 2026
89c9aa9
fix: defer member cleanup when lead or members have active runs
Leoyzen Jul 22, 2026
b8bc9ec
fix(opencode): populate AssistantMessage tokens/cost from EventProces…
Leoyzen Jul 22, 2026
2903bfa
feat: team_create prompt param, watch mode for list_blackboard/team_s…
Leoyzen Jul 22, 2026
a1e2b47
feat: task_update note field for progress tracking
Leoyzen Jul 22, 2026
6372d5a
feat: prompt members to use task_update(note=...) for progress
Leoyzen Jul 22, 2026
cf59bab
feat: notice_role config for system/user message injection
Leoyzen Jul 22, 2026
1f9744d
fix(opencode): handle SystemPromptPart in user message event processing
Leoyzen Jul 22, 2026
25bed9b
fix: wrap SystemPromptPart in ModelRequest for enqueue compatibility
Leoyzen Jul 22, 2026
e78c95e
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 23, 2026
be46872
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 23, 2026
7018e0b
feat(team-mode): merge shutdown_request into team_remove_member, add …
Leoyzen Jul 23, 2026
b8581ca
feat(team-mode): add unfinished task reminder harness for team members
Leoyzen Jul 23, 2026
790ee8f
feat(team-mode): add watch_task_ids to list_blackboard and team_statu…
Leoyzen Jul 23, 2026
9e4d878
feat(team-mode): add owner parameter to task_create
Leoyzen Jul 23, 2026
99aa736
feat(team-mode): add max_watch_timeout config and timeout<=0 no-limit…
Leoyzen Jul 23, 2026
35ea2c3
fix(storage): enable SQLite WAL mode and busy_timeout to prevent data…
Leoyzen Jul 23, 2026
bcf4c70
fix(team-mode): event-driven ephemeral member cleanup instead of 5s p…
Leoyzen Jul 23, 2026
bbae2fb
feat(team-mode): notify lead when member crashes via unified message …
Leoyzen Jul 23, 2026
2f5e406
feat(team-mode): make idle_timeout and poll_interval YAML-configurable
Leoyzen Jul 23, 2026
3232d24
feat(team-mode): push notifications for task assignment and unblock
Leoyzen Jul 23, 2026
85b7f3f
fix(team-mode): use team_member_name for task_update permission check
Leoyzen Jul 24, 2026
40d7139
fix(team-mode): check session.is_closing before chaining queued prompts
Leoyzen Jul 24, 2026
a253f80
feat(team-mode): allow members to use task_create for subtasks
Leoyzen Jul 24, 2026
19f79c2
fix(team-mode): suppress member crash notification during normal shut…
Leoyzen Jul 24, 2026
744ec4b
refactor(team): switch child session creation from RunLoopDelegationS…
Leoyzen Jul 24, 2026
2efb714
fix(identifiers): switch session IDs to descending order to match Ope…
Leoyzen Jul 24, 2026
9da3a80
fix: sync created_at_ns with session ID timestamp for consistent orde…
Leoyzen Jul 24, 2026
0ca588a
Merge branch 'main' into feat/dynamic-team-mode
Leoyzen Jul 24, 2026
f80fba1
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 24, 2026
386a52c
deps: upgrade pydantic-ai-slim from 2.9.0 to >=2.12.0
Leoyzen Jul 24, 2026
30cf514
fix: default request_limit to None (unlimited) for native agents
Leoyzen Jul 25, 2026
7733a0a
Merge branch 'main' into feat/dynamic-team-mode
Leoyzen Jul 25, 2026
89c2251
fix(team-mode): add 2ms delay between member session creations
Leoyzen Jul 25, 2026
e4ff40c
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 25, 2026
86d4b34
fix(opencode): override stored created_at with session ID timestamp
Leoyzen Jul 25, 2026
66e7a90
fix(team-mode): add 10ms delay in _create_member_session for distinct…
Leoyzen Jul 25, 2026
3645d78
fix(team-mode): randomize delay 5-20ms in _create_member_session
Leoyzen Jul 25, 2026
605f5d7
fix(team-mode): increase delay range to 15-50ms in _create_member_ses…
Leoyzen Jul 25, 2026
39ef412
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 26, 2026
8ce5dec
fix(opencode): use per-step delta for AssistantMessage.tokens
Leoyzen Jul 26, 2026
7d11c80
fix(team-mode): add debug log for _create_member_session delay
Leoyzen Jul 26, 2026
88ed4d0
fix(team-mode): use asyncio.Lock instead of random delay for session …
Leoyzen Jul 26, 2026
5265d44
fix: resolve ruff lint errors from origin/main merge
Leoyzen Jul 27, 2026
5f1d1d8
feat(team-mode): collab-flow improvements — per-member instructions, …
Leoyzen Jul 27, 2026
a2453a6
Merge remote-tracking branch 'origin/main' into feat/dynamic-team-mode
Leoyzen Jul 27, 2026
e1d63b7
feat(team-mode): enrich spawn events and ToolPart with team context
Leoyzen Jul 27, 2026
c27f1be
fix(opencode): use display_name in _update_parent_toolpart and _updat…
Leoyzen Jul 27, 2026
5aedb8e
fix(opencode): update child session title after ensure_session
Leoyzen Jul 27, 2026
69c23d4
fix(team-mode): correct tool_call_id, spawn_mechanism, and display pr…
Leoyzen Jul 27, 2026
4c2f433
fix(opencode): remove redundant tool name from ToolState title
Leoyzen Jul 27, 2026
abf1d3f
fix(team-mode): prefer semantic member names in team_add_member descr…
Leoyzen Jul 28, 2026
ac3c218
fix: ProtocolChannel closed errors, CI type ignores, flaky benchmark,…
Leoyzen Jul 28, 2026
cafff6b
fix(team-mode): TDD fixes for format_task_xml crash, state.json race,…
Leoyzen Jul 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,88 @@ Teams are compiled into pydantic-graph workflows:

See the Graph Architecture section below for full details.

#### Team Mode

Team mode extends AgentPool with LLM-driven dynamic team creation and coordination at runtime through tool calls. Unlike static `graph:` or `teams:` pipelines, team mode lets the model decide team composition, member roles, and coordination strategy based on the task.

**Configuration**: Add a `team_mode:` section at the top level of your YAML manifest:

```yaml
team_mode:
enabled: true # Required: enable team mode
lead_eligible: # Agents allowed to be team leads
- coordinator
member_eligible: # Agents allowed as team members
- coordinator
- researcher
- writer
defaults: # Optional: default members for team_create
team_name: "default_team"
members:
- name: "lead"
agent: "coordinator"
instructions: "You coordinate the team. Assign tasks and track progress."
- name: "researcher"
agent: "researcher"
instructions: "You gather data and write findings to blackboard key 'raw_data'."
bounds: # Optional: resource constraints
max_members: 6
max_parallel_members: 3
max_member_turns: 50
max_wall_clock_minutes: 180
blackboard: # Optional: shared team memory
write_policy: "lead_only"
max_size_mb: 50
auto_urgent: # Topics treated as urgent
- escalation
- pricing_approval
```

**15 Team Mode Tools**: Once team mode is enabled, the lead agent receives these tools. Tools are split into two scopes: Universal (available to all team members) and Lead-only (available only to the team lead).

| Tool | Scope | Description |
|---|---|---|
| `send_message` | Universal | Send a message to a specific team member. Supports `persist_to_blackboard` to auto-save the message body to a blackboard key. |
| `task_create` | Universal | Assign a task to a team member |
| `task_list` | Universal | List all tasks and their statuses. Supports `mine_only` to filter tasks assigned to the caller. |
| `task_update` | Universal | Update a task's status, `technical_note`, `handoff_to`, `handoff_context_keys`, `progress_current`, or `progress_total`. |
| `task_get` | Universal | Get the details of a single task |
| `read_blackboard` | Universal | Read the team's shared blackboard (persistent across turns) |
| `write_blackboard` | Universal | Write to the shared blackboard |
| `list_blackboard` | Universal | List keys on the shared blackboard |
| `team_status` | Universal | Check team health, member status, and resource usage |
| `team_create` | Lead-only | Create a new team with members from eligible agents |
| `team_delete` | Lead-only | Dissolve a team and release its resources |
| `delete_blackboard` | Lead-only | Delete a key from the shared blackboard |
| `shutdown_request` | Lead-only | Remove a team member and release its resources |
| `team_add_member` | Lead-only | Add a new member to an existing team |
| `task_create_batch` | Lead-only | Create multiple tasks atomically with inter-task dependencies using `#N` or symbolic `id` references |

**Channel Boundaries**: The protocol template defines three distinct channels for team coordination. **Tasks** (task_create, task_get, task_list, task_update, task_create_batch) provide structured work tracking with status, progress, and dependencies. **Blackboard** (read_blackboard, write_blackboard, list_blackboard, delete_blackboard) provides persistent shared state accessible across members and turns. **Messages** (send_message) provide ephemeral communication between members.

**Auto-complete Progress**: When `task_update(status="completed")` is called and `progress_total` is set but `progress_current` is not provided, the system auto-sets `progress_current = progress_total`.

**Handoff Semantics**: `task_update(status="completed", handoff_to="member")` sends a notification to the target member with blackboard context from `handoff_context_keys`. Dependency-resolved notifications are sent automatically when blocking tasks complete.

**Default Members**: When `defaults:` is configured, `team_create` uses these members when the LLM calls it without explicit members. The LLM must still call `team_create` explicitly.

**Relationship to `graph:` and `teams:`**:

Team mode coexists with the existing static team approaches. They serve different use cases:

- `graph:` / `teams:`: Static DAGs for known pipelines and predictable workflows. Best when you know the exact agent topology ahead of time.
- `team_mode:`: Dynamic LLM-driven teams for ad hoc collaboration. Best when the task demands runtime decisions about who does what.

You can combine both in the same config: use `graph:` for fixed preprocessing pipelines and `team_mode:` for the downstream agent that coordinates collaborators dynamically.

**Key Constraints**:

- Native agents only (ACP agents are not supported as team members).
- No cross-team blackboard sharing between teams.
- No multi-user authentication (all team actions run under the same session context).

**Full Example Configs** are available at `site/examples/team-translation/config.yml`, `site/examples/team-sales/config.yml`, and `site/examples/team-dev-squad/config.yml`.

#### Tool System
Tools follow PydanticAI's tool pattern with AgentPool extensions:
- Tools are typed functions with Pydantic schemas
Expand Down
Loading
Loading