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.
Run the following command to import the decorators into the target environment, sending the data array from your export as the request body:
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:
Run the following command to import the decorators into the target environment.
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:
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/importwith 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.