Tools#

Define a single, runnable capability that agents (or your app) can call.

What is a “tool”?#

A tool is a self-contained skill that an agent (or your app) can call to get real work done (summarize text, create a ticket, query a DB, call an internal API). In AgentPM, a tool:

  • Exposes a typed interface via inputs and outputs (JSON Schema), so agents know exactly what to pass and what to expect.
  • Becomes a callable function through the SDKs; the agent (or your app) invokes it just like any other tool/function in its runtime.
  • Runs in a managed subprocess, isolating dependencies from the agent host so Node ↔ Python mixes are safe and deterministic.
  • Advertises capabilities (name, description, schema) that agent planners can use for tool selection and argument construction.
  • Publishes portable artifacts (manifest + files) that agents can install, verify, and reuse across stacks and languages.

Inspect and run a selected release#

The Registry Tool page leads with Interface and Runtime & execution. Interface shows the selected version’s input fields and output-schema variants; author-provided variant titles are retained, otherwise labels are neutral. The full input/output schemas and agent.json remain available in disclosures and Source. Plain object schemas use a compact object summary; the complete JSON Schema remains available. A schema branch is not automatically a success or error result.

Get Started offers Install, direct agentpm run, and Node/Python SDK loading for the selected exact version. Tool invocation uses the installed workspace and its required runtime/credentials; it does not use AgentPM Harness. A valid schema-level example does not establish local readiness or a successful result.

When a valid input example is available in the input schema’s examples or example annotation, it is labeled author-provided. Otherwise the page attempts a conservative schema-derived starter, validates it against that schema, and labels description text as placeholder data. Complex, unsupported or unavailable schemas fall back to --input-file input.json; supply a file that conforms to the selected Tool’s input schema. This does not change the CLI’s own JSON-only input validation. See run.

The Run command’s shell selector provides macOS/Linux and PowerShell 7.3+ JSON quoting. It selects command syntax, not the Tool’s runtime.

When a selected Python release has a recorded resolution, Pinned distributions counts that snapshot and Resolved environment reveals its exact distribution versions, markers and SHA-256 hashes. Declared requirements are shown separately. Older or unprepared releases may have no snapshot; pins do not establish local provisioning success or identical wheel bytes across OS/CPU/interpreter targets. The Tool detail API exposes this validated snapshot as nullable python_resolution.

Overview’s Evidence rows use the selected release’s Registry Health data. Unavailable checks stay unknown or not evaluated; a declaration alone does not establish conformance. The dedicated Health & Security tab retains deeper evidence.

The compact required-environment notice links to Runtime & execution. Environment rows show authored requirements/descriptions and public defaults; Copy variable name copies only the name, never a local environment value. The page does not read your credentials. CLI compatibility/update guidance links to installation and updates, separately from runtime readiness.

Scaffold a tool#

agentpm init --kind tool --name summarize --description "Summarize input text"

Generated skeleton (agent.json):

{
  "$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": "tool",
  "name": "summarize",
  "version": "0.1.0",
  "description": "Summarize input text",
  "entrypoint": {
    "args": ["main.py"],
    "command": "python3"
  },
  "files": ["main.py"],
  "inputs": {},
  "outputs": {},
  "runtime": {
    "type": "python",
    "version": "3"
  }
}
Note

The scaffold includes a runnable Python JSON echo script in main.py. Replace it with your Tool implementation and update the input/output schemas before sharing it. Run agentpm lint for guidance.

Field reference (overview)#

FieldTypeRequiredNotes
$schemastringnoURI to this schema (optional but recommended)
standardobjectyes for APDSDefinition contract: {"id":"agentpm","version":"1.0.0"}; see standard selection.
kindenumyesMust be "tool"
namestringyes^[a-z][a-z0-9-]{0,63}$
versionsemveryesSemVer string (supports pre/metadata)
descriptionstringyesFree text
entrypointstringyesExecution ref {command, args, cwd, timeout_ms, env}
inputsobjectyesJSON Schema (or shape) for inputs
outputsobjectyesJSON Schema (or shape) for outputs
filesstring[]yesNon-empty list of literal package-relative file/directory paths; missing entries stop packaging. Globs are not expanded.
runtimeobjectno{ type: "python or node", version: "MAJOR[.MINOR[.PATCH]]" }
environmentobjectnoDictionary of required or optional env variables {required, description, default}
readmestringnoPath to README file. Will automatically look for README.md if not specified.
licenseobjectno{ spdx: "license spdx", file: "Path to LICENSE file" }

Defining the entrypoint#

"entrypoint": {
  "command": "node",               // interpreter: node|nodejs|python|python3 (or absolute path)
  "args": ["dist/summarize.js"],   // script/module path (repo-relative)
  "cwd": ".",                     // optional working dir
  "timeout_ms": 60000,            // optional execution timeout
  "env": { }                     // optional env vars passed to subprocess
},
"runtime": {
  "type": "node",
  "version": "20"               // major or full semver your tool requires
}
Tip

Lint enforces that runtime.type matches the interpreter implied by entrypoint.command.

Defining the environment#

Use agent.json → environment.vars to declare the env vars your tool expects. These are tool-facing variables (API keys, endpoints, knobs) that the CLI runner validates and merges with process environment, manifest defaults and SDK caller overrides; see environment settings.

  • Keys must be UPPER_SNAKE_CASE (^[A-Z][A-Z0-9_]*$).
  • Each var has:
    • required: boolean
    • description: string
    • optional default: string (used if the caller doesn’t supply a value)
{
  "environment": {
    "vars": {
      "OPENAI_API_KEY": {
        "required": true,
        "description": "API key for OpenAI"
      },
      "OPENAI_BASE_URL": {
        "required": false,
        "description": "Custom API endpoint; defaults to https://api.openai.com/v1",
        "default": "https://api.openai.com/v1"
      }
    }
  }
}
Required env vars are enforced by the SDK

If a tool declares required environment variables without a default, the SDK load() function will fail immediately when that variable is missing. Provide the value by passing it per-call via load().

Notes

  • These declarations power docs in the registry UI and validation in the SDKs.

Defining inputs and outputs (JSON Schema)#

Both inputs and outputs are any valid Draft 2020-12 JSON Schema. Below are common patterns—mix and match as needed.

1) Minimal object with a required field#

"inputs": {
  "type": "object",
  "properties": {
    "text": { "type": "string", "description": "Text to process" }
  },
  "required": ["text"],
  "additionalProperties": false
},
"outputs": {
  "type": "object",
  "properties": {
    "summary": { "type": "string" }
  },
  "required": ["summary"],
  "additionalProperties": false
}

2) Optional params with defaults (document in description)#

"inputs": {
  "type": "object",
  "properties": {
    "text": { "type": "string" },
    "max_sentences": { "type": "integer", "minimum": 1, "maximum": 10, "description": "Default: 3" }
  },
  "required": ["text"],
  "additionalProperties": false
}

3) Enums, unions, and nullable#

"inputs": {
  "type": "object",
  "properties": {
    "text": { "type": "string" },
    "style": { "type": "string", "enum": ["bullet", "abstract", "headline"] },
    "language": {
      "oneOf": [
        { "type": "string", "enum": ["en","es","fr","de"] },
        { "type": "null" }
      ],
      "description": "If null, auto-detect."
    }
  },
  "required": ["text"],
  "additionalProperties": false
}

4) Arrays and item schemas#

"inputs": {
  "type": "object",
  "properties": {
    "documents": {
      "type": "array",
      "items": { "type": "string", "minLength": 1 },
      "minItems": 1
    }
  },
  "required": ["documents"],
  "additionalProperties": false
}

5) Numbers with constraints (good for budgets/limits)#

"inputs": {
  "type": "object",
  "properties": {
    "budget_ms": { "type": "number", "minimum": 0, "maximum": 10000 }
  },
  "required": ["budget_ms"],
  "additionalProperties": false
}

6) Nested objects and patternProperties#

"inputs": {
  "type": "object",
  "properties": {
    "text": { "type": "string" },
    "metadata": {
      "type": "object",
      "patternProperties": {
        "^[a-zA-Z_][a-zA-Z0-9_]*$": { "type": ["string","number","boolean"] }
      },
      "additionalProperties": false
    }
  },
  "required": ["text"],
  "additionalProperties": false
}

7) Discriminated unions (advanced)#

"inputs": {
  "oneOf": [
    {
      "type": "object",
      "properties": { "mode": { "const": "single" }, "text": { "type": "string" } },
      "required": ["mode","text"],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": { "mode": { "const": "batch" }, "documents": { "type": "array", "items": { "type": "string" }, "minItems": 1 } },
      "required": ["mode","documents"],
      "additionalProperties": false
    }
  ]
}

Guidance:

  • Prefer type:"object" + properties + required for clarity.
  • Use additionalProperties:false to catch typos early.
  • Document sensible defaults in description or add an output field like used_defaults if the tool applies them.

Packaging files#

Include everything your tool needs at runtime:

"files": [
  "dist/**",
  "prompts/*.md",
  "models/*.bin"
]
  • Paths are literal package-relative files or directories. Globs are not expanded. A missing declared path stops packaging, including dry-runs.
  • The published archive preserves relative paths.
  • Make sure your entrypoint.args points at a packaged file.

Best practices#

  • Strong schemas: Validate early with agentpm lint --strict.
  • Env & timeouts: Declare any required env vars in docs; set timeout_ms to bound execution.
  • Runtime clarity: Keep runtime.type/version in sync with your actual interpreter.
  • Determinism: Pin version, publish with CI, and let consumers lock via agent.lock.
  • Docs from manifest: Good description + field descriptions render as rich docs in the registry.

Next steps#

  • Fill in entrypoint, inputs, outputs, and files.
  • Run:
agentpm lint --strict
agentpm publish --dry-run
  • When ready:
agentpm publish
  • See the Agents page next for composing multiple tools.