Promote decorators between environments

Decorators don’t automatically transfer when you promote an agent project. Export them from the source environment and import them into each target environment before running sessions that depend on them.

Before you begin

Before exporting decorators, make sure you have the following:

  • API access to both the source and target environments.
  • A valid authentication token for each environment.

Export decorators

Use GET /tools/decorators/bulk/export to retrieve all decorators from the source environment. The response is a JSON object: the data array holds the exported decorators used for import, and the skip, limit, and total fields describe pagination.

1{
2 "skip": 0,
3 "limit": 100,
4 "total": 27,
5 "data": [
6 {}
7 ]
8}

Run the following command to import the decorators into the target environment, sending the data array from your export as the request body:

$curl -X GET https://<source-host>/tools/decorators/bulk/export \
> -H "Authorization: Bearer <token>" \
> -o decorators-export.json

Replace <source-host> with your source environment hostname and <token> with your API token.

The export includes all decorators in the environment, not just those attached to a specific project. Review the exported file and remove any decorators you don’t want to promote before importing into the target environment.

Import decorators

Use POST /tools/decorators/bulk/import to import the decorators into the target environment. If a decorator with the same ID already exists in the target, it’s overwritten. If it doesn’t exist, it’s created.

The request body is a JSON object with a decorators array, set to the data array from your export:

1{
2 "decorators": [
3 {}
4 ]
5}

Run the following command to import the decorators into the target environment.

$curl -X POST /tools/decorators/bulk/import \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d @decorators-export.json

Replace <target-host> with your target environment hostname and <token> with a valid API token for that environment.

Repeat for each target environment.

Promote in the right order

Decorators must exist in the target environment before any session invokes a tool that references them. Promote your assets in this order:

1

Import decorators into the target environment.

2

Import your agent project and confirm all tool dependencies exist.

3

Verify that every tool with a decorator in the source environment has a matching decorator in the target before running sessions.

Handle a missing decorator

If a tool has a decorator attached in the source environment but that decorator doesn’t exist in the target, any session that calls that tool fails at runtime. Itential can’t run the tool without the decorator it expects. When this happens, choose one of the following:

  • Import the missing decorator - Re-run POST /tools/decorators/bulk/import with the decorators from the source environment. Use this when the decorator should exist in the target environment.
  • Remove the tool from the agent - Edit the agent in the target environment to remove the tool that references the missing decorator, if that tool isn’t needed there.

A session that fails because of a missing decorator may leave in-progress operations in an incomplete state. Import the missing decorator, create a target-specific version via API, or remove the tool from the agent before retrying the session.