delegate_task
Delegate a coding task to a headless CLI agent for parallel execution. Returns a task ID immediately; check progress with get_task_result.
Instructions
Delegate a coding task to a CLI agent running in headless mode.
The agent is sandboxed to cwd directory only. Use include_dirs to grant access to additional directories.
Use this for parallel work: code review, testing, refactoring, analysis, or any dev task.
Returns a task_id immediately (non-blocking). Use get_task_result to check status and retrieve the result.
IMPORTANT: CLI providers can take ~15-20s before the agent begins working. Set timeout to at least 60s for simple tasks, 300s+ for complex analysis.
WORKSPACE: The agent can only use file tools within cwd and include_dirs. For other paths it can use shell commands (cat, find, ls).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory for the agent. Defaults to current working directory. | |
| files | No | Known relevant file paths used as structured focus hints for context resolution. May include paths attached in the UI. | |
| model | No | Model to use in provider/model format (e.g. deepseek/deepseek-v4-pro). Leave empty for default. | |
| skill | No | Activate a global or active workspace skill by name before executing the task. Use list_skills to see available skills. | |
| policy | No | Policy file for tool restrictions. Use built-in template name (e.g. "read-only", "safe-edit") or absolute path to .yaml policy file. | |
| prompt | Yes | The task description for the CLI agent. Be specific and detailed. | |
| runner | No | Runner ID from agent-pool.config.json. Default: "local". Use SSH runners for remote execution. | |
| chat_id | No | Chat ID to bind this task to in the UI. Optional. | |
| timeout | No | Timeout in seconds. Default: 600 (10 minutes). | |
| provider | No | CLI provider to use. codex = Codex CLI, antigravity = Antigravity CLI, opencode = OpenCode CLI, claude = Claude Code CLI. Default: codex. | |
| agent_slug | No | Agent identity slug (e.g. "backend-engineer"). Auto-resolves prompt from team-memory agents/{slug}.md with composed skills. Takes priority over legacy "skill" parameter. | |
| session_id | No | Resume an existing provider session/thread by ID. Supported by Antigravity, Codex, OpenCode, and Claude Code where available. Use list_sessions for Antigravity sessions. | |
| focus_graph | No | Portal-provided compact project-graph focus context for files[], including symbols, imports, dependencies, and web component summaries when present. Usually injected automatically; direct callers should prefer files[]. | |
| serviceTier | No | Service tier for Codex. Codex maps to service_tier. | |
| context_mode | No | Context package mode for delegated agents. auto injects the metadata-first resolved context package. off disables injection. Default: auto. | |
| include_dirs | No | Additional directories to include in the agent workspace scope. By default the agent only has access to cwd. Use this to grant access to other project dirs, config dirs, etc. | |
| on_wait_hint | No | Custom coaching message shown when polling for results. Guides the calling agent on what to do while waiting. | |
| allowed_tools | No | Provider tool allowlist passed to compatible runners. For Claude, entries map to --allowedTools, e.g. "Bash(node --check *)". | |
| approval_mode | No | Approval mode: yolo (auto-approve all), auto_edit (auto-approve edits only), plan (read-only). Default: yolo. | |
| system_prompt | No | Pre-resolved system prompt to prepend to the task. Overrides agent_slug resolution. Used by portal for portal-level agent injection. | |
| parent_chat_id | No | The parent chat or task ID that initiated this delegation. Used for hierarchy. Optional. | |
| resource_group | No | Existing resource group from local portal configuration. Overrides the agent frontmatter resource_group. | |
| reasoningEffort | No | Provider reasoning effort. Codex accepts the selected model value and maps it to model_reasoning_effort. Claude Code accepts low, medium, high, xhigh, or max and maps it to --effort. |