Language
You can use TypeScript or regular JavaScript for custom code.Where you can use code
Depending on your needs, you have a few options on where to write code in Studio. Here’s a cheat sheet:
Check out each section below for a more detailed breakdown:
Actions
Actions are reusable code snippets that only Autonomous Nodes can use. Use Actions when:- You need to execute a piece of code more than once
- You want AI to decide when to execute your code
Execute Code Cards
Execute Code Cards execute a one-time piece of code at some point in a Workflow. They’re not reusable and can’t be added to an Autonomous Node. Use Execute Code Cards when:- You only need to execute a piece of code in one place
- You want complete control over when the code executes
Hooks
Hooks execute code at specific stages of your bot’s operation, like before every user message or after every conversation ends. They operate separately from your bot’s conversational logic—when you create a Hook, it always executes at the same stage, no matter what changes you make to your Workflow. Use Hooks when:- You need to execute a piece of code every time your bot reaches a certain stage of its operation
- You need access to information about the Autonomous Node’s iteration or the current turn’s metadata