Agent in a script
Using an agent in the Script Editor works much like calling an API.
Follow these steps to make use of an agent in a script:
-
Go to edit mode.
-
In the Reusable components pane, open Agents and find the agent you want to use. Drag and drop it to the name of your script in the list of scripts in your project.
Result: You are prompted to provide a context name.
-
Open the code snippets to find example JS code on how to use your agent. You will be using the agent through a name like
agents.MyAgentName, whereMyAgentNameis the context name you set before.
Here is a minimal call to an agent with the context name Test:
const result = await agents.Test({
input: "Your prompt here",
});
log.info("AI response:", result);
For the full API — all call options, streaming callbacks, and thread management — see Agent API for scripts.