Skip to content

fix(dispatch): map custom agents to general-purpose in swarm background dispatch#977

Merged
magicpro97 merged 1 commit into
mainfrom
fix/swarm-custom-agent-401-dispatch
Jun 10, 2026
Merged

fix(dispatch): map custom agents to general-purpose in swarm background dispatch#977
magicpro97 merged 1 commit into
mainfrom
fix/swarm-custom-agent-401-dispatch

Conversation

@magicpro97

Copy link
Copy Markdown
Owner

Problem

Custom project agents (e.g. \lambda-developer, \ rontend-developer) cause:
\
CAPIError: 401 401 401 Invalid auto-mode selector
\
when dispatched via \ ask()\ in background mode. The \ ask()\ tool only supports built-in agent types in background dispatch.

Root cause

\cmd_swarm()\ passed the user-supplied --agent-type\ value directly into the generated \ ask()\ call for both --output prompt\ and --output parallel\ modes. Custom agent types are not valid for \ ask()\ background dispatch.

Fix

  • Extract _TASK_BUILTIN_AGENT_TYPES\ (frozenset) at module level documenting which agents are valid
  • Add _resolve_dispatch_agent_type()\ helper — returns 'general-purpose'\ for any unrecognised agent, identity for built-ins
  • Replace two duplicated inline sets in \cmd_swarm()\ (prompt + parallel output modes) with calls to the helper
  • Run
    uff format\ to clean whitespace

Testing


  • uff check\ → all checks passed

  • uff format\ → reformatted (1 file)
  • ✅ 579 tests passed (\ est_tentacle_runtime.py)

…nd dispatch

Custom project agents (lambda-developer, frontend-developer, etc.) cause
CAPIError 401 'Invalid auto-mode selector' when dispatched via task() in
background mode, because the task() tool only accepts built-in agent types
(explore, task, general-purpose, rubber-duck, code-review, research,
security-review).

Changes:
- Extract _TASK_BUILTIN_AGENT_TYPES (frozenset) at module level
- Add _resolve_dispatch_agent_type() helper — returns 'general-purpose'
  for any custom agent, identity for built-ins
- Replace two duplicated inline sets in cmd_swarm() (prompt + parallel
  output modes) with calls to the helper
- Run ruff format to clean whitespace

Fixes: swarm --agent-type lambda-developer no longer produces broken
task() calls that fail with 401 in background dispatch.
@magicpro97 magicpro97 merged commit 5d8493a into main Jun 10, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant