SHEPHERDdocs Search the docs/ v0.5.3-beta
On this pageThe YAML formatValidationEnd to end example

Pattern YAML

The file format of a pattern and how it is validated.

Works inCLI

The YAML format

name: webteam                     # required; letters, digits, hyphen or underscore
kind: orchestrator-worker         # orchestrator-worker | hierarchical | blackboard | market
description: Free text
topics:
- name: orders                    # required and unique
  partitions: 4                   # 1 to 256 (default 1)
  key: task_id                    # informational hint about the partition key
  filter: hypothesis              # optional: prefix expected in messages
  max_messages: 12                # optional: a hard cap; the next publish fails (default: no limit)
agents:
- id: orchestrator                # required and unique
  role: brain                     # a role from your configuration (brings permissions and skills)
  vendor: claude                  # optional: replaces the role's vendor
  model: haiku                    # optional: replaces the role's model
  prompt: Instructions            # the persona; up to 16,384 characters
  count: 1                        # instances (1 to 32; at most 64 agents in total)
  level: 0                        # hierarchical only: tier in the tree
  publishes: [orders]             # topics it writes to
  consumes: [results]             # topics it reads from
  group: worker-pool              # consumer group shared by the instances
  start: true                     # this agent receives the objective and starts the run

Things to know:

  • prompt replaces the role's working script. The role contributes only vendor, model, permissions and skills. The agent also receives its topology, its topics and the objective.
  • Every publishes and consumes entry must name a declared topic.
  • max_messages is a hard cap on a topic: once it holds that many messages the next publish fails with a message telling the agent to stop, and the run shows as stalled. Use it on feedback loops so they cannot run away. Without it a topic has no limit.
  • The description can have several paragraphs. Lists show the first; the built-in patterns use the next ones for Use it when and an example, and the apps and pattern show display them.
  • If no agent has start: true, the topology's default starter is used: the orchestrator, the director, the researcher, or the requesters.
  • Agents that do not start simply wait. They are woken when a message arrives on a topic they consume.
  • With count > 1 the instances share group: each partition is divided among them and each message goes to exactly one member.
  • Agent ids in a pattern (worker) differ from the ids the running agents get (coder-1, coder-2). Use shepherd agents to see the running ones.

Validation

pattern validate reports each problem with a severity and a field path:

$ shepherd pattern validate t-market
pattern has validation problems:
  [warning] agents[0].vendor: vendor 'claude' is configured but its command 'claude' is not installed or not in PATH
  [error] agents: market pattern requires at least 2 solver agent instances publishing to 'bid', found 1

An error stops a run. A warning informs you (for example, a vendor that is not installed, a model the vendor does not list, or a topic nobody publishes to or reads from).

What is checked:

  • Identifiers and limits: valid, unique pattern name and agent ids; at least one agent and at most 64; count from 1 to 32; partitions from 1 to 256; persona up to 16,384 characters.
  • Topics: every topic named in publishes or consumes exists; duplicate topic names are an error.
  • Configuration: the role exists in your configuration; the vendor and model are known.
  • Topology: the rules of the chosen kind, listed above.

The editors in the terminal UI and the native app show the same messages next to the field that caused them.

End to end example

An orchestrator and two workers add two independent features to a Go service.

cd ~/webgo

# 1) copy, adjust and validate
shepherd pattern new webteam --from orchestrator-worker
#    edit .shepherd/patterns/webteam.yaml: vendor claude, model haiku, worker count 2
shepherd pattern validate webteam

# 2) run it with an objective
shepherd pattern run webteam --task \
  "One worker adds GET /version (version.go + test); the other adds a logging middleware (logging.go + test). Each in its own worktree, not touching the other's files, and commit."

# 3) watch
shepherd pattern runs
shepherd agents
shepherd topic groups orders        # worker-pool with 2 members and the lag per partition
shepherd topic tail results         # the workers' reports

# 4) when the run is done, integrate with plain git
git worktree list
git merge --no-edit shep/6-run-webteam-189105
git merge --no-edit shep/7-run-webteam-189105
go vet ./... && go test ./...

# 5) clean up
git worktree remove ~/.shepherd/worktrees/webgo/shep-6-run-webteam-189105
git branch -d shep/6-run-webteam-189105 shep/7-run-webteam-189105

Each worker ends with its own branch, commit and snapshots. The two branches merge cleanly because the workers did not touch each other's files.

Was this page useful?Suggest an edit on GitHub