Agent function examples
Complete agent functions you can adapt. Each table, column or API drawn as a chip, such as orders, orders.email or createTicket, is a reference you insert from the editor's suggestions. When you rebuild an example, pick your own tables, columns and APIs: type " after tables.search( or apis.execute(, or "@ anywhere else. See Get suggestions.
Agent functions
An agent function is a short piece of JavaScript that your AI agent runs when it needs custom logic: looking up a record, calling one of your systems, or preparing data before the agent replies. From its code, an agent function can work with your tables, call the APIs configured for your agent, read and update global variables, and, on runtime 2026.10.19, send messages to the user while it works.
Call APIs from agent functions
This page covers calling your APIs from the code of an agent function with apis.execute from "@yellow/bot". The APIs themselves are set up under Build → API. Credentials such as API keys stay in the API's settings and never appear in your code.
Crypto helpers in agent functions
crypto from "@yellow/bot" creates IDs, hashes and signs values, and encrypts and decrypts with AES. These helpers don't count towards any limit, and they return their result directly, so no await is needed.
Function tool
What shipped
Halt the agent's turn
Check or change a function's version in the editor's status bar. See Runtime versions.
Handle errors in agent functions
A function fails when its code throws, when a call it makes fails and isn't caught, or when it goes past a limit. This page covers what the agent or flow sees then, the errors you're likely to meet, and how to keep the conversation going.
JavaScript in agent functions
Agent functions run modern JavaScript in a secure sandbox, not in Node.js or a browser. This page lists what the language gives you, the built-ins added for you, and what's blocked.
KB Metadata Search
Overview
Runtime versions
Every agent function runs on a dated runtime version: the set of features its code can use, such as which modules it can import. A function's version never changes on its own. You move it to a newer version when you want what that version adds, and you can move it back.
Send messages while a function runs
Check or change a function's version in the editor's status bar. See Runtime versions.
Test and debug agent functions
Test an agent function with the Run button while you build it, and add console logs to see what it did, both in the editor and in live conversations.
Use global variables in agent functions
Global variables hold information the rest of the conversation can use, such as the customer's tier, their language, or the last order they asked about. An agent function can read them to make decisions, and update them so that later steps (other agents, flows or functions) can use what it found.
Work with tables in agent functions
This page covers using your agent's database tables from the code of an agent function: searching, inserting and updating rows with tables from "@yellow/bot". You create the tables and their columns on the Database page.
Work with voice calls
Check or change a function's version in the editor's status bar. See Runtime versions.