Templates#

Author workflow templates that generate editable AgentPM workspaces.

What is a template?#

A kind: "template" manifest describes a scaffold package, not a runnable tool or a single installed agent.

Templates are used by:

agentpm new <template-ref> [target-dir]

They define:

  • what files are copied/rendered into a generated project
  • what tool and agent dependencies should be installed into that project
  • what variables are available during generation
  • what next-step commands should be shown after scaffolding

Scaffold a template#

agentpm init --kind template --name research-template --description "Bootstrap a research workflow"

This creates:

research-template/
  agent.json
  template/
    README.md

agentpm init --kind template scaffolds the template package shell only. It does not create consumer output like template/agent.json.

Minimal example#

{
  "$schema": "https://raw.githubusercontent.com/agentpm-dev/cli/refs/tags/apds-v1.0.0/standards/agentpm/1.0.0/manifest.schema.json",
  "standard": { "id": "agentpm", "version": "1.0.0" },
  "kind": "template",
  "name": "research-template",
  "version": "0.1.0",
  "description": "Bootstrap a research workflow",
  "template": {
    "display_name": "Research Template",
    "use_case": "starter",
    "execution_surfaces": ["python-sdk", "agentpm-run"],
    "stack": ["python"],
    "files_root": "template",
    "variables": [
      {
        "name": "project_name",
        "description": "Generated project name. Generation-time only; do not use for API keys, tokens, passwords, or runtime secrets.",
        "required": true,
        "default": "research-template"
      }
    ],
    "dependencies": {
      "tools": ["@zack/fetch-content", "@zack/summarize"],
      "agents": []
    },
    "entrypoints": [
      {
        "label": "Run the generated app",
        "command": "python -m app.main"
      }
    ]
  }
}

Key fields#

template.files_root#

template.files_root points to the scaffold tree inside the template package.

Example:

my-template/
  agent.json
  template/
    README.md
    .env.example
    app/
      main.py

AgentPM copies and renders files from template/ into the target project.

Do not place a root agent.json in template.files_root

agentpm new synthesizes the generated project’s root agent.json. Template authors should not place a root agent.json inside template.files_root.

template.variables#

Variables are generation-time scaffold inputs.

  • names use lowercase snake_case
  • values can come from --var, defaults, or interactive prompts
  • unknown placeholder text may be preserved literally if it is not a declared variable match

Use variables for scaffold text like project names or example titles, not for runtime secrets.

template.dependencies.tools#

These are direct runnable tool dependencies for the generated project.

  • they are installed into the generated workspace
  • they contribute to the generated agent.lock
  • direct tool dependencies often end up represented in the generated root agent.json

template.dependencies.skills#

Templates may also declare direct skill dependencies for the generated project:

  • they install into the generated workspace
  • they contribute first-class skills relationships to the generated lockfile
  • they typically end up represented in the generated root agent.json → skills[]

template.dependencies.knowledge#

Templates may also declare direct knowledge dependencies for the generated project:

  • they install into the generated workspace
  • they contribute first-class knowledge relationships to the generated lockfile
  • they typically end up represented in the generated root agent.json → knowledge[]

template.dependencies.memory#

Templates may also declare direct memory dependencies for the generated project:

  • they install into the generated workspace
  • they contribute first-class memory relationships to the generated lockfile
  • they typically end up represented in the generated root agent.json → memory[]

template.dependencies.profiles#

Templates may also declare direct profile dependencies for the generated project:

  • they install into the generated workspace
  • they contribute first-class profiles relationships to the generated lockfile
  • they typically end up represented in the generated root agent.json → profiles[]

template.dependencies.loop#

Templates may also declare one direct loop dependency for the generated project:

  • it installs into the generated workspace under .agentpm/loops/...
  • it contributes a first-class singular loop relationship to the generated lockfile
  • it is written into the synthesized root agent.json → loop

Example:

{
  "template": {
    "dependencies": {
      "loop": "@zack/incident-response-loop@1.0.0"
    }
  }
}

This field is singular by design. Templates may declare at most one direct dependencies.loop.

template.dependencies.agents#

These are direct agent package roots for the generated workspace.

  • they are installed as workspace/package roots
  • they do not add recursive agents[] support to normal kind: "agent" manifests
  • they are recorded in agentpm.workspace.json when needed

Templates may depend on multiple agents. Normal agent manifests still may not depend on agents.

template.entrypoints#

These define the next-step commands AgentPM shows after generation.

Example:

[
  { "label": "Review generated scaffold", "command": "cat README.md" },
  { "label": "Run the app", "command": "python -m app.main" }
]

Generated project layout#

Depending on the template, agentpm new may generate:

my-project/
  agent.json
  agents/
    reviewer.agent.json
  agentpm.workspace.json
  agent.lock
  .agentpm/
    template.json

Meaning:

  • agent.json — primary/default local agent manifest
  • agents/*.agent.json — additional local generated agents
  • agentpm.workspace.json — committed workspace topology
  • agent.lock — runnable dependency lockfile
  • .agentpm/template.json — template origin metadata

The agents/ convention#

If a template wants to generate additional local agent manifests, place them under:

template/
  agents/
    triage.agent.json
    reviewer.agent.json

AgentPM treats agents/ as the canonical location for extra local generated agents.

Editable generated manifests#

Generated manifests should be straightforward for users to edit later.

In practice:

  • agentpm new synthesizes the root agent.json
  • any direct template loop dependency is written there as the exact resolved loop reference
  • extra local generated agents, when present, live under agents/
  • users can edit those generated manifests after scaffolding

After generation, users should be able to edit the generated manifests and rerun:

agentpm install

to regenerate agent.lock.

README split#

Template authors should maintain two separate READMEs:

  • root README.md — explains the template package in the registry
  • template/README.md (or the chosen files_root README) — explains the generated project

The scaffold README may include render-variable examples intended for generated-project users.

Typical workflow#

agentpm init --kind template --name my-template --description "My workflow template"
cd my-template
# edit agent.json and files under template/
agentpm lint --strict
agentpm new . ../my-template-test
cd ../my-template-test
# run the generated project's documented entrypoint
cd ../my-template
agentpm publish

Harness execution surface#

For a starter whose intended entrypoint is Harness, declare "execution_surfaces": ["agentpm-harness"] (and an SDK surface too if the app hosts Harness through an SDK). Use agentpm-run for a starter intended to call individual Tools directly. Execution surfaces describe the authored workflow; they do not install a different runtime. The maintained Harness templates are listed in example projects.

Inspect a published Template on the website#

The selected version's Scaffold overview section explains its use case, actual scaffold content root, stack and intended execution surfaces. A manifest path is not a browsable file tree; the page does not invent project files or file previews. Declared dependencies retain their authored kinds and version selectors. Exact links require a unique identity in the current authorized dependency resolution; unavailable or ambiguous resolution remains visibly unresolved. It is not a historical lockfile.

Variables & suggested commands preserves generation-variable descriptions, explicit required/optional settings and exact defaults, including empty strings. These are non-secret scaffold configuration, not runtime credentials. Longer lists expand to retain every declaration.

Get Started shows agentpm new for the actual selected release and an explicit project destination. Suggested next steps shows the first authored command only. View all suggested commands opens the complete commands disclosure and focuses it below the sticky navigation. All labels and commands remain inspectable and copyable; the page does not execute them. Creating a project does not establish successful dependency installation, command execution or local Runner readiness.

The author README remains separate from the scaffold README. Full selected agent.json, its standard reference and qualified Registry-recorded evidence stay available. Unsupported or malformed metadata preserves Source without a replacement project definition. CLI-version guidance distinguishes compatibility from readiness.

The first suggested command includes a directory change matching the example's my-project destination. It uses cd my-project && before the authored command (macOS/Linux or PowerShell 7+), so a failed directory change does not run that command in the wrong directory. Use your chosen destination if you change it. The full Suggested commands disclosure keeps the original template.entrypoints values and explains that they run from the generated project directory.

AgentPM derives project_name from the sanitized destination folder name unless --var project_name=... overrides it. With an explicit my-project destination, that derived name takes precedence over a declared project_name default. Other variables use explicit values or their declared defaults. A required value with no default still needs a supplied value or an interactive prompt; required with a default does not automatically mean the user must type a value.