Split Complex Workflows with Inline Sub-Agents

August 9, 2026 · View on GitHub

One workflow file, multiple specialised agents — each doing exactly one thing, at the right cost.

:dart: What You'll Do

You'll add a sub-agent to your daily-status workflow so the parent agent can stay focused on planning and final writing while a focused sub-agent handles one repeated task. By the end of this step, your workflow will be easier to scale without turning the whole prompt into one long, repetitive brief.

:clipboard: Before You Start

Understand the parent agent and sub-agent split

When your workflow repeats the same small job for many items, keep the parent agent focused on the overall plan and final output. Move the repeated item-by-item work into a sub-agent.

Inline sub-agent pattern: parent agent plans and delegates repeated tasks to sub-agents, then assembles the final output

A sub-agent is just a helper you define inside the same workflow file. In this step, you only need one syntax rule: start the helper with a level-2 heading that begins with ## agent: and a backtick-wrapped name. Put the helper brief under that heading. If you want, add a short frontmatter block with fields such as description or model. Then call that helper by name from the parent workflow brief.

:thinking: Predict: Look at your current workflow. Which instruction repeats once per issue, pull request, or file? Keep that answer in mind for the next section.

[!TIP] Want the full rules for names, frontmatter, model aliases, and block placement? See the existing Side Quest: Sub-Agent Syntax Reference. Stay on this page if you only want the main path.

Apply the pattern to your workflow

Pick one repeated task

Open your workflow file and choose one bounded task that repeats for each item, such as summarizing one issue or classifying one pull request.

Action: Before you edit, choose these two things:

  • the sub-agent name you want to use
  • the one-sentence job that sub-agent should do

Add one sub-agent block

In your AI agent, run this prompt:

/agentic-workflows update .github/workflows/daily-status.md to add an inline
sub-agent named `issue-summarizer` that reads one GitHub issue and returns a
one-sentence summary. Use model: small. Also update the parent brief to call
this sub-agent once per open issue and compile the summaries into a numbered list.

The skill appends the sub-agent block at the bottom of the file and updates the parent brief. Review the diff before committing.

Here is the sub-agent syntax the skill will add:

## agent: `issue-summarizer`
---
description: Summarizes a single open issue in one sentence
model: small
---

Read the title and body of one GitHub issue. Return exactly one sentence
that explains what the issue is asking for and its current status.

Keep the sub-agent brief narrow. If it processes one item at a time and returns a single result, it belongs here.

:desktop_computer: Terminal path

After your parent workflow brief, at the bottom of the file, add the sub-agent block shown above. Then update the parent brief to call it by name. For example:

For each issue, use the `issue-summarizer` agent to produce a one-sentence summary.

After editing both, run gh aw compile to regenerate the lock file.

Verify the diff and commit

The skill edits both the sub-agent block and the parent brief in one step. Review the diff, then commit:

git add .
git commit -m "feat: add issue-summarizer sub-agent to daily-status"
git push

Run and verify

Trigger a manual run. In the Actions log, confirm the parent agent calls your sub-agent and then uses the sub-agent result in the final summary.

✅ Checkpoint

  • You identified one repeated task in your workflow that fits a sub-agent
  • You wrote a sub-agent name and one-sentence job before editing the file
  • Your workflow file now includes at least one ## agent: \name`` block
  • You updated the main brief to call the sub-agent by name
  • The compiled lock file was updated and committed alongside the workflow source
  • A manual run completed and the Actions log showed the sub-agent being called
  • The final workflow output used the sub-agent result

Next: Make Your Workflows Resilient to Failure