> ## Documentation Index
> Fetch the complete documentation index at: https://docs.docwriter.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Delegating tasks

> Use the agent for longer-running, multi-step work that does not fit a single chat turn.

The agent is the [Claude Agent
SDK](https://docs.claude.com/en/agent-sdk/overview), so it has the
SDK's full [tool inventory](https://docs.claude.com/en/docs/claude-code/tools-reference):
file I/O, shell, web search, sub-agents, MCP servers, and so on. This
means you can hand it work that does not fit a single chat turn
(research, multi-file restructures, build-fix-rebuild loops), and come
back to the result.

## Examples

These are the kinds of prompts that benefit from the agent's wider tool
access:

* *"Read every chapter in `manuscript/` and produce a one-line summary of
  each into `outline.md`."* A loop over many files, writing into a
  separate one.
* *"Find every passive-voice sentence in `essay.md` and propose
  active-voice rewrites."* Multiple edits in one file, each surfaced as
  its own pending review.
* *"Compile `main.tex`. If pdflatex errors, fix the source and rebuild.
  Continue until the build succeeds."* Shell execution plus iteration.
* *"Look at the references in `paper.bib` and check that each one has a
  DOI. Add any missing DOIs by searching the web."* Web-search tool plus
  file edits.
* *"Convert every Markdown heading in `notes/` from H2 to H3."* Bulk
  mechanical edits across files.

## How long-running work looks in the UI

When you submit a long task, the history pane on the right streams every
step the agent takes: each file it reads, each edit it proposes, each
shell command, each error. You can watch progress without staying glued
to a particular spot.

If the task produces several edits, each one shows up as a separate
pending review card in the right pane. Accept or reject them in order.

## Keep writing while it runs

Long tasks do not block you. The agent works as a concurrent editor: you
can continue editing any open file while the agent reads or writes
others. When the agent's edit lands in a file you have been typing in,
your concurrent typing is preserved.

## Stopping a long task

Click the agent pill at the top of the history pane to stop the current
turn. Any pending reviews
already produced remain in the outline pane; you can accept or reject
them. Subsequent tool calls do not run.

## Sub-agents

For tasks that need parallelism or isolation, the agent can spawn
**sub-agents** via the SDK's `Agent` tool. Each sub-agent runs its own
agent loop with its own context. In the history pane, sub-agent work
appears nested under a parent card; the `SubagentStop` hook fires when
one finishes (see [Hook events](/automation/events)). You do not usually
need to ask for sub-agents explicitly. The agent decides to use them
when the work parallelizes naturally. See the SDK's
[sub-agent docs](https://docs.claude.com/en/docs/claude-code/tools-reference)
for details on configuration and isolation semantics.

## When not to delegate

Long tasks rely on the agent making many decisions without your input. If
you want to make those decisions yourself, prefer shorter steering: ask
for one thing at a time, review, and move on. The interface is built for
fast back-and-forth, so cheap iteration is often better than handing over
a complex multi-step job.

## Where to go next

* [Steering the agent](/agent/steering-the-agent). For short,
  conversational tasks.
* [Comments](/agent/comments). When the agent should give feedback
  without editing.
* [Hooks](/automation/hooks). To fire build commands after agent work
  lands.
