Documentation Index
Fetch the complete documentation index at: https://documentation.uponai.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Code Tool lets your agent run JavaScript code inline during a call. It’s ideal for lightweight tasks like data transformation, formatting, and simple read-only API lookups without needing to set up a custom function endpoint.Setup
Name and describe it
Give the tool a unique name and a clear description so the LLM knows when to invoke it.
Write your JavaScript
Use the available globals in your script:
Standard built-ins (
| Global | Description |
|---|---|
dv | Access agent dynamic variables as strings |
metadata | Call metadata passed via API |
fetch(url) | Make HTTP requests |
console.log() | Debug output |
Math, JSON, Date, Array methods) work normally. require and import are not available.Extract response values
Map JSON paths from your script’s return value to dynamic variable names for use later in the conversation.
Configuration Options
| Setting | Default | Range |
|---|---|---|
| Timeout | 30 seconds | 5–60 seconds |
| Response cap | 15,000 characters | — |
| Speech after execution | Enabled | — |
When to Use Code Tool vs. Custom Functions
| Use Code Tool for | Use Custom Functions for |
|---|---|
| Data formatting | Internal system access |
| Simple calculations | Database writes |
| Read-only public API calls | Sensitive credentials |
| Routing logic | Audit logging |
| Payment processing |