vigiles API reference
    Preparing search index...

    Function agent

    • Define a subagent specification (compiles to agents/<name>.md).

      // agents/reviewer.md.spec.ts export default agent({ name: "reviewer", description: "Review a diff for correctness. Dispatch PROACTIVELY after edits.", model: "sonnet", tools: ["Read", "Grep", "Bash"], body: instructionsReview the diff. Run ${cmd("npm test")} first., rules: { "no-floating": enforce("@typescript-eslint/no-floating-promises", "Await promises."), }, });

      Generic over a tool Vocabulary (default OpenToolVocabulary — no constraint). A harness adapter re-exports a vocabulary-bound agent (e.g. vigiles/claude-code) so purity: "pure" + a side-effecting tool is a tsc error at edit time; the bare core agent() accepts any tools, as before.

      Also generic over the result's Ok/Err shapes, inferred from output: result(...). The returned value is a TypedAgentSpec<Ok, Err> — an AgentSpec that carries those shapes at the type level, so a typed pipe can cross-reference the handoff. With no output the shapes default to the erased Shape, and the value is still a plain AgentSpec — backwards-compatible.

      Type Parameters

      Parameters

      Returns TypedAgentSpec<Ok, Err>