# Package, Import, and Update
{{< tier level="sovereign" >}}

Your program passed its [direct test](../quickstart/#4-run-it-directly). Now make it available to agents and workflows: validate and package the files, then import the pack. The steps below continue the `my-tools` example.

## Validate and package

Run these from the directory containing `my-tools`, using a Valdr CLI that supports user tools:

```bash
valdr validate-pack my-tools
valdr generate-valdr-pack my-tools \
  --output build/my-tools.valdr-pack.tar.gz \
  --exported-at 0
```

`validate-pack` checks every manifest, schema, and inventoried file before anything reaches Valdr. `--exported-at 0` fixes the archive timestamp so the same source always produces the same archive. Neither command runs your tool.

Keep `pack.yaml`, the manifest, and your program in version control. The generated archive is a build output, so don't edit it by hand.

## Import and inspect

1. Open **Settings > Valdr Packs > Import Pack** and select `build/my-tools.valdr-pack.tar.gz`.
2. Review the preview: tool IDs, revisions, content hashes, files, and what each tool will run. Then import.
3. Open **Workflows > Tools** and select **Text summary** to check its details and manifest.

{{< thumbcard src="/images/ui/workflows/tools-catalog-grid.png" alt="Workflows Tools tab showing installed tool cards with icon, name, tool ID, revision, description, pack, and action count" caption="Every installed tool, its revision, and its pack in one catalog." position="top" >}}

Try it in a disposable environment first. A valid archive proves the pack is well formed; only a real run proves the runtime is installed and the action works on that host.

## Call your tool from an agent

After import, an agent can find your tool with `pm_user_tool search`, inspect its inputs with `describe`, and call `run` with an absolute working directory and a request ID. No workflow is needed. Follow [Call User Tools through MCP](/valdr/docs/valdr-mcp/user-tools/) for an example, or continue below to add the tool to a reusable workflow.

## Run your tool in a workflow

1. Open a draft workflow in the Builder and add **Text summary** from the **User tools** library group. Its single action, `summarize`, is selected automatically.
2. In **Inputs**, choose `text` and enter some text, for example `Hello Valdr` followed by a new line and `Tools are ready.` Leave **Working directory (cwd)** empty; this action doesn't read files.
3. Map outputs to `$.normalized.data.characters`, `$.normalized.data.words`, and `$.normalized.data.lines`.
4. Choose **Test** and open the run in **Runs**. Expect 28 characters, 5 words, and 2 lines.
5. Use the outputs downstream. For example, `${steps.summarize.outputs.words}` works when this step's key is `summarize` and the consuming step declares `needs: [summarize]`.

In YAML, the step's inputs and output mappings sit beside the `tool` reference the Builder created:

```yaml
# Fragment of the step selected in the Builder; keep its tool reference.
inputs:
  text: "Hello Valdr\nTools are ready."
outputs:
  characters: "$.normalized.data.characters"
  words: "$.normalized.data.words"
  lines: "$.normalized.data.lines"
```

The Builder writes the full `tool` reference: ID, action, revision, content hash, and both schemas. If you edit YAML by hand, copy that reference from the Builder rather than typing a hash. See [Pin a user tool](/valdr/docs/workflows/definition-authoring/#pin-a-user-tool).

To run the tool in a specific folder, add `cwd` beside `tool` and `inputs`, for example `cwd: ./scripts`. Relative paths resolve from the workflow's worktree or project repository, and the folder must already exist. `cwd` configures the step, so never put it inside `inputs`.

## Ship a new revision

Tool revisions are how you change behavior without surprising anyone:

1. Update the program and bump `revision` in the manifest. In the example, also update the program's `toolRevision` check, and its `toolId` check if you chose your own ID, plus your direct-test request.
2. Validate, package, and import the new archive.
3. In each workflow that should get the change, select the new revision in **Installed revision** and save a new workflow version.

For new steps, the Builder prefers the highest semantic version among available tool revisions. If none use semantic versions, it compares the revision labels as text. Check **Installed revision** when adding a step. Existing steps and past runs keep their original pins; selecting a new revision affects the workflow version you save next.

Bump the revision whenever the manifest or its listed files change. Reusing an existing revision for changed content requires an explicitly approved pack overwrite. Valdr blocks that overwrite while an active workflow pins the content being replaced; publish a new tool revision so you can choose when to upgrade each workflow. Direct MCP calls select the most recently installed revision shown in the catalog by default, so use `revision` when you need a particular version label. Only one revision of each tool can be in a single pack archive.

## Export and share

Export carries the tool's source files and the pins that workflows reference, so a teammate can import the same reviewed revision. It doesn't carry environment values, runtimes, dependencies, or CLI sign-ins. Each host supplies its own. A pinned tool doesn't pin the version of an external CLI it calls.

**Each archive supports one revision per tool ID.** Export fails if the included workflows pin different revisions of the same tool. Export includes every active workflow version in the selected packs, so saving a newer workflow version doesn't exclude older active versions. You can select packs to export, but not individual workflow versions within a pack.

To share workflows with different pins:

- Export separate pack selections when each selection uses only one revision of each tool.
- If the conflict is within one pack, [build separate archives from maintained source](#validate-and-package), each containing one revision of each tool and only workflows pinned to those revisions. Keep the tool IDs and owning `pack` value unchanged so the receiving host can import both revisions. Validate each archive before sharing it.

## Next step

[Test and troubleshoot](/valdr/docs/workflows/user-tools/testing/) your tool before you share the pack.

