Agents and Automation in Claude Code: Which Tool to Use
Claude Code can work in more than a single conversation. You can delegate tasks to dedicated agents, run sessions in the background and schedule recurring work. To avoid getting lost, here is the map, as it appears in the guide updated for October 2026.
The delegation ladder
The higher you climb, the less you describe "how" and the more you describe "what":
| You... | The tool |
|---|---|
| Type a message | A regular conversation |
| Describe a side task | Subagent: its own context window, returns a summary |
| Hand independent tasks to the background | Agent view (claude agents): background sessions |
| Describe a team | Agent Teams: a lead and teammates, a shared task list |
| Describe a recurring plan | Dynamic Workflow: a script holds the plan |
| Describe an ongoing goal | Routine or Managed Agent: runs without you |
Subagents
Agents are defined as Markdown files in .claude/agents/ (project) or ~/.claude/agents/ (personal):
---
name: security-reviewer
description: Reviews changes for security issues. Use after changes to permissions and authentication.
tools: Read, Grep, Glob
model: sonnet
---
You are a security reviewer. Look for injections, leaked secrets and missing permission checks.
- Required fields:
nameanddescription. Optional:toolsandmodel. - They run in an isolated context and return a summary, so the main session stays clean.
- Great for a second opinion, parallel perspectives and read-only review.
/subtask <task>: a background Subagent that inherits the entire conversation (a fork)./agentsno longer opens an interface. Just ask Claude "create a subagent that..." or edit the files.
Agent view and background sessions
claude agents: one screen showing all background sessions, their state and which ones are waiting for you (Research preview)./background: detaches the current session to the background./fork: copies the conversation into a new background session and continues here.- Sessions sent from agent view automatically move to their own worktree before they edit files.
In September 2026 the ability to send messages between sessions was added, on the same machine, another machine or the cloud, so you can pass findings instead of copying context between terminals. The /list-agents command shows who you can talk to.
Agent Teams
- Experimental and off by default. Enabled through an environment variable in
.claude/settings.json. - A lead and teammates who message each other directly and share a task list.
- Uses many more tokens. Teammates are not isolated in worktrees, so split the work so that each one owns different files.
Dynamic Workflows
A Workflow is a JavaScript script that Claude writes, and it orchestrates many Subagents. The key difference: the script holds the plan, not Claude turn by turn. Intermediate results stay in the script's variables and do not fill the context.
How to trigger one:
/deep-research <question>: a built-in Workflow for research with cross-checked sources.- Write "use a workflow ..." in your request, or add the keyword
ultracodeto your prompt. /effort ultracode: Claude plans a Workflow for every significant task in the session. This is expensive. Since September 2026 it is a separate switch from the effort level.
To monitor: /workflows shows steps, agents and tokens. p pauses, x stops, s saves it as a command in .claude/workflows/.
Limits: up to 16 agents in parallel by default (CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS) and up to 1,000 agents per run. A Large workflow warning appears above 25 agents or 1.5M tokens.
Good examples: scan all routes for missing auth checks, migrate 500 files, or "run tsc and fix until it passes".
Routines vs. Cowork
| Routine | Cowork | |
|---|---|---|
| Tied to | A GitHub repo | Connected tools |
| Produces | Pull Requests | Briefings, drafts, actions |
| Can | Clone code and run tests | Read and write Gmail, Notion, Slack, Drive |
| Triggers | Schedule, API, GitHub event | Schedule |
The rule: is the output a change in a repo? Routine (/schedule). Otherwise, Cowork.
A few related tools:
/loop [interval] [prompt]: repeats as long as the local session is open./autofix-pr: a cloud session that follows a PR and pushes fixes when CI fails or when there are comments./goal [condition]: Claude keeps working until the condition is met.
Managed Agents
Anthropic hosts the loop, the sandbox and the tools: the Agent SDK without servers. It includes memory stores (workspace-level and per user) that persist between sessions. The cost is tokens at API list prices plus $0.08 per active session hour (waiting time is not counted).
The distinguishing rule: are you scheduling against a repo? Routine. Do your users trigger it from inside a product? Managed Agent.
Quick choice
| You need... | Choose |
|---|---|
| A second opinion without cluttering the conversation | Subagent |
| Several perspectives in parallel | Subagents or Agent Teams |
| Several independent tasks that I only review | Agent view |
| The same multi-step process again and again | Workflow (and save it as a command) |
| A PR on a schedule | Routine |
| A briefing or an action across tools | Cowork |
| A user triggering it from inside a product | Managed Agent |
Common mistakes
- A whole fleet of agents when one Subagent is enough.
- A free-roaming agent when you actually need a deterministic Workflow.
- Forgetting a stop condition.
- Automating something you never did manually.
How to start without getting tangled
The guide suggests a few simple steps from its "ten things to do this week" list that fit this topic too:
- Plan mode for every multi-file change (
/plan). - An instruction you repeat becomes a Skill.
- An action you repeat becomes a Command.
- Connect one real system through MCP.
And the rule from the "common mistakes" section is worth repeating: automate only something you have already done manually. When you know what the process looks like when it works, it is much easier to decide whether you need a Subagent, a Workflow or a Routine, and what the stop condition will be.
The full guide is free on GitHub (in Hebrew), and also available as a website: https://tovtechorg.github.io/Claude-Code-in-Hebrew/.