run_agent
Delegate coding tasks to a local LLM-powered agent that executes in your project and returns a job ID for tracking.
Instructions
Delegate a task to an agent on a local model. Returns a job id immediately.
The agent is a headless Claude Code session (Read/Edit/Write/Glob/Grep/Bash, project
CLAUDE.md, same working tree) whose API calls go to the local endpoint. Write the task like a
brief for a capable but junior engineer: what to do, where, how to verify, and what to report.
Args:
task: The brief. Be explicit; local models follow less implicit context than Claude.
model: Pool name (see list_models) or a served model id/glob. Default from models.yaml.
endpoint: Force a specific endpoint; with no `model`, uses whatever it is serving.
cwd: Working directory (default: this server's cwd, i.e. the current project).
isolation: "none" (work in cwd, like a normal subagent) or "worktree" (fresh git worktree
on branch local-agent/<job>; kept only if the agent changed something, reported in
job.worktree with a diffstat). Use worktree for risky/large edits you want to review as a diff.
wait_s: If > 0, block up to this many seconds and return the result when done (else job id).
permission_mode: acceptEdits (default) | bypassPermissions | default | plan.
max_turns: Cap on agent turns (default from models.yaml).
allowed_tools: Override auto-approved tools.
system_prompt_append: Extra instructions appended to the Claude Code system prompt.
resume_job: Continue a previous job's session (same model) with `task` as the next message.
timeout_s: Wall-clock cap for the job.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | ||
| task | Yes | ||
| model | No | ||
| wait_s | No | ||
| endpoint | No | ||
| isolation | No | none | |
| max_turns | No | ||
| timeout_s | No | ||
| resume_job | No | ||
| allowed_tools | No | ||
| permission_mode | No | ||
| system_prompt_append | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||