Harness Engineering 6 months ahead, in a few hours.

Module 16 — Build your own agent

Updated

In this module

You will know how to build an agent that runs one of your workflows end to end, from a ticket number to a verified PR. You will write its main skill, which runs existing skills and hands the work to subagents. This agent records its progress in a file, the journal. You will also write the tool that drives your app on a device or in a browser, and linter rules that check your conventions at every edit. Finally, you will place checks before every irreversible action, such as a push.

16.1 — What a workflow agent is

You type a ticket number. You come back an hour later to an open PR, with passing tests and screenshots of the feature. A workflow agent makes this trip without you. It assembles the skills (module 4), hooks (module 5) and subagents (section 4.8) that this course taught you to write.

In practice, this agent is a skill, called an orchestrator skill. Its SKILL.md describes the phases of the workflow. For each phase, it tells Claude which existing skill to run and which part of the work to hand to a subagent, which works in its own context window.

The example in this module

This module follows a real agent, written for an Android app. You give it a Jira ticket number. It goes all the way to an open PR, after checking the change on an emulator, a simulated Android phone running on the computer. It goes through nine phases.

0. Intake. It reads the ticket and creates a worktree, which is a separate working copy of the repository. It opens its journal, the file where it records its progress.

1. Design. It reads the Figma mockup if the ticket cites one.

2. Sync. It regenerates the API schema and the translations.

3. Refinement. It clarifies the need from the ticket, the code and the mockup.

4. Plan. It breaks the work into tasks. A second agent, which this module calls the challenger, challenges this plan.

5. Implementation. One subagent per task writes the code and runs the tests.

6. Review. Two reviewers read the diff with the same checklist.

7. On-device verification. It drives the app on the emulator and compares each screen to the mockup.

8. Delivery. It commits, runs its checks, pushes, opens the PR and monitors the CI, the repository's automated tests.

The human steps in only at moments fixed in advance. They answer a business question that no source settles, such as the expected behavior when a list is empty. They resolve Git conflicts, and the human is always the one who merges the PR.

To drive the app, the agent relies on a second skill, which this module calls the driver. Its script reads the screen, taps the buttons and takes screenshots. Section 16.6 shows how to write yours, for a browser, an API or a database.

The following sections build the same agent for a web app, the one from the exercise (section 16.11). The passages that start with "On the Android agent" tell what the real agent ran into.

When to build one

A workflow agent is worth the effort when your task meets these conditions.

  • You do it often, and the same way each time.
  • It has several steps, which you already chain in your head.
  • Its result can be checked by a tool, such as tests, a build, a screenshot or a query.
  • Its steps rely on sources the agent can read on its own, such as the ticket, the code, the mockup or the schemas.

The same reasoning applies to a web feature, an API endpoint, a data migration or a documentation page.

When to do without one

  • The task comes up once a quarter. A well-written prompt or plan mode (section 2.8) is enough.
  • The result can only be judged by eye, like sales copy. The agent would announce a success that nothing proves.
  • The workflow changes every time. You would spend more time maintaining the agent than doing the task.
  • You have not yet done the task by hand several times. The agent reproduces your method, so run it yourself first.

Start small. An agent that goes from the ticket to a tested branch is already useful. You will add delivery once the checks of section 16.9 are in place.

Key takeaways

• A workflow agent is an orchestrator skill. It carries out an entire task, from the input to the verified result, by running existing skills and subagents.

• It relies on a driver, a script that drives the app on a device, in a browser or through its API.

• Build one for a frequent task, in several steps, whose result can be checked.

• The human settles business questions and Git conflicts, and the human is always the one who merges the PR.

In this module

  1. 16.1 — What a workflow agent is Available
  2. 16.2 — Map your workflow before you write
  3. 16.3 — The skeleton of the orchestrator SKILL.md
  4. 16.4 — Keep state out of the conversation
  5. 16.5 — Delegate to subagents
  6. 16.6 — Write your driver
  7. 16.7 — Linter rules to keep the agent in line
  8. 16.8 — Bounded loops and evidence
  9. 16.9 — Guardrails before the irreversible
  10. 16.10 — Keep the agent alive
  11. 16.11 — Guided exercise: your first workflow agent

Locked content

Unlock the full course to access this module.

€89 excl. VAT

€106.80 incl. VAT for EU customers · One-time payment

Already purchased? Recover access