Run an AI agent
run_agentStart an AI agent run. It spends the workspace's AI credits (402 when there are none: a Pro workspace buys a pack, a Free one upgrades). A run is ASYNCHRONOUS: run_agent returns the run at once in state "queued". Call get_agent_run with its id every few seconds until the state is "proposed" (a plan or re-plan waiting for a decision), "completed" (a digest — nothing to apply) or "failed" (see error). Most runs take under a minute. A proposal changes nothing until apply_agent_run; show it to the user and let them decide first. Kinds and their input (a JSON object, passed as a string): "plan-generator" (no projectId; Administrator/ProjectManager) drafts a new project: {"goal": "what the project is", "startDate": "yyyy-MM-dd", "endDate": optional, "constraints": optional, "language": "en"|"id"|…, "maxTasks": 3–300}. "schedule-doctor" (projectId; Administrator/ProjectManager) re-plans a project that slipped: {"instruction": "what happened, e.g. the pour slipped 9 days" (optional), "language"}. "status-digest" (projectId; any team role) writes a status report: {"audience": "team"|"client"|"exec", "from": "yyyy-MM-dd", "to": "yyyy-MM-dd" (default the last 7 days), "language"}; it ends "completed" and its text is in plan.text.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | Agent kind: plan-generator, schedule-doctor or status-digest | |
| input | Yes | The agent's input as a JSON object string, e.g. {"audience":"client"}. Use {} for the defaults. | |
| projectId | No | Project id — required by schedule-doctor and status-digest, omitted for plan-generator |