Skip to content

patterns/builtin-kit.halo ​

examples/patterns/builtin-kit.halo tools: policies

Open in the playground and play with it →

halo
// The built-in kit: agent presets, skills, and utility tools, with nothing to declare
// but the model.
//
//   halo agents                 the presets
//   halo skills                 the skills (yours in ./skills, then the built-in ones)
//   halo test examples/patterns/builtin-kit.halo -p ReviewChanges --arg base=HEAD~1
//   halo run  examples/patterns/builtin-kit.halo -p WeeklyNumbers --args '{"orders":[{"id":1,"status":"paid","total":120},{"id":2,"status":"open","total":40}]}'

policy ReadOnly : AllowEffects(read)

tool Repo : Git(".")
tool Rows : Data()
tool Math : Calc(precision: 2)
tool Time : Clock(timezone: "UTC")
tool Kit  : Skills("./skills")

// A preset is a ready-made system prompt, settings and skills: you pick the model.
agent Reviewer [anthropic/claude-sonnet-4-5, preset: CodeReviewer, tools: auto]
  system "This is a TypeScript project that runs on Bun."
  equips Repo
  requires ReadOnly

agent Gate [anthropic/claude-haiku-4-5, preset: Judge]

agent Notes [anthropic/claude-haiku-4-5, preset: Writer, skills: "release-notes"]

// No preset: this agent reads the skill list and loads what it needs itself.
agent Helper [anthropic/claude-haiku-4-5]
  equips Kit, Time, Math

// Review the changes since a ref. The reviewer reads around the diff with Git itself
// (read-only, by policy), answers JSON, and a judge checks the review is specific.
pipeline ReviewChanges(base: String) -> Result:
  base
    |> Repo.diff(from: "{{base}}") as change
    |> Reviewer.review("Review this change.", context.data.change.diff) as review
    |> Gate.grade("Does every finding name a file, a line and a concrete fix?", context.data.review) as verdict
    |? (context.data.verdict.pass == true)
    |> System.Value(context.data.review)

// Release notes from the commit log, with the release-notes skill.
pipeline ReleaseNotes(version: String) -> Result:
  version
    |> Repo.log(limit: 30) as commits
    |> Time.now() as today
    |> Notes.write("Release notes for {{version}}, dated {{context.data.today.date}}.", context.data.commits)

// Numbers from tools, not from a model: filter, total, change.
pipeline WeeklyNumbers(orders: Array) -> Result:
  orders
    |> Rows.filter(where: "status == 'paid'") as paid
    |> Rows.aggregate(data: context.data.paid, field: "total", op: "sum") as revenue
    |> Math.eval(expression: "{{context.data.revenue}} * 0.8") as net
    |> Rows.count(data: orders, by: "status") as by_status

// Anything else: the helper picks a skill (and the clock or calculator) on its own.
pipeline Ask(task: String) -> Result:
  task |> Helper.work(tools: [Kit, Time, Math])

curl -fsSL https://halolang.com/install.sh | sh