run_thronglet
Run a coding agent (Claude Code, Codex, OpenCode) on a task in a directory and return its final message as JSON. Supports background execution.
Instructions
Runs a coding agent (Claude Code, Codex, OpenCode) on a task in cwd and returns its final message as JSON {session_id, text, stop_reason, usage, duration_s, warnings?}; with schema, structured replaces text. description names the thronglet for listings. With background: true the call returns {session_id, state, queued} as soon as the turn runs; collect the result with wait_thronglet.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | Yes | Absolute path; the agent works in this tree | |
| agent | Yes | <harness>/<model>[:<effort>], e.g. claude/opus[1m]:max, codex/gpt-6-sol:xhigh; valid values: list_harnesses | |
| prompt | Yes | Task for the agent | |
| schema | No | JSON Schema (draft-07 or 2020-12) for structured output: the agent submits a matching result, returned as `structured` instead of `text` | |
| timeout_s | No | Wall-clock limit for the run in seconds; default from config (21600) | |
| background | No | Return as soon as the turn is running (or queued behind the session's current turn); collect the result with wait_thronglet | |
| description | Yes | What this thronglet is for, in a few words; shown in session listings |