Agent tools

task

task({ agent, description, prompt })

Hand a self-contained job to a subagent with a fresh context. Several in one turn run in parallel, and you get back only the report.

category: taskfree to callparallel in one turn
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

agentstringrequired

Which subagent — the declaration lists what is available.

descriptionstringrequired

Three to six words, shown to the user: « Read the tax form ».

promptstringrequired

The whole job. It sees nothing of this conversation.

A fresh context is the point

Write a complete prompt

The subagent gets the prompt and nothing else — not the conversation, not what was read, not what was decided. The tool's own description says so: name the goal, the paths, and exactly what to report.

When the agent is told to use it

  • Several independent things to investigate or produce — several task calls in the same turn, running in parallel.
  • A job that would fill its context with material it will not need afterwards.
  • Not for one or two quick reads: those it does itself.

What a subagent gets

InheritedNot
The mode and the permission callbackThe conversation
The budget, sharedask_user, todo_write, memory
The machine and the workspaceA step ceiling above 40
Its own tools and model, from its fileSubagents of its own

What comes back

Its final message, plus a line of figures — turns, tool calls, credits, and why it stopped. Its events reach your onEvent carrying parentId as they happen.

Calling it is free; what it does is not

The category is task, always allowed — because every tool the subagent then calls goes through the same permission callback, with the arguments in hand.