Custom Code Tools & Sandboxed Execution
Code Tools allow you to add custom JavaScript logic directly into your Omnisetu LLM workflows — performing math calculations, data transformations, and custom business logic in a secure sandbox.
Overview
Programmable In-Workflow Intelligence
Combine conversational AI with custom JavaScript snippets. Execute fast, secure computations inside an isolated sandbox runtime without building external webhooks.
Native JavaScript Execution
Write standard JavaScript functions that receive structured inputs from the LLM and return clean result objects.
Isolated Sandbox
Runs inside high-speed isolated sandboxes with 128MB RAM, 3000ms timeout controls, and zero network side-effects.
Zero Network Overhead
Instant calculations without waiting for network round-trips to external microservices.
Execution Flow
How Code Tools Work
LLM agents run isolated JavaScript calculations in a secure sandbox.
User Request
User asks for a query requiring computation (e.g. 'Calculate cart total').
LLM Bot Intent
LLM identifies that custom calculation logic is required.
Code Tool Call
Passes structured input variables to the configured Code Tool.
Sandbox Execution
Runs JavaScript function inside secure 3000ms sandbox.
Result Output
Returns calculated result JSON (e.g. Subtotal, Tax, Grand Total).
LLM Response
LLM incorporates calculated output into a natural final response.
Interactive Demo
Code Execution Preview
See how a custom JavaScript snippet receives LLM variables, executes business logic, and returns formatted data.
Custom Math & Cart Calculation
Example: Shopping Cart Subtotal, Shipping, & Tax
When a customer asks for order pricing, the LLM agent extracts the cart items and destination, passing them as inputs into the Code Tool.
function main({ cartItems, shippingCountry }) {
// Compute cart subtotal
const subtotal = cartItems.reduce(
(total, item) => total + (item.price * item.quantity), 0
);
// Shipping rate logic
const shippingCost = shippingCountry === "US" ? 5.99 : 14.99;
const taxRate = 0.08;
const tax = subtotal * taxRate;
const grandTotal = subtotal + shippingCost + tax;
return {
subtotal: subtotal.toFixed(2),
shippingCost: shippingCost.toFixed(2),
tax: tax.toFixed(2),
grandTotal: grandTotal.toFixed(2),
currency: "USD"
};
}
Security Overview
Isolated Sandbox Environment
Built for high-performance isolated computation with strict security controls.
Language
JavaScript (ES2024)
Runtime
Isolated Sandbox
Execution Limit
3000 ms Max
Memory Allocation
128 MB RAM
Network Access
Restricted (No External Calls)
Built-in Utilities
Math, Date, JSON, RegExp, Array
Use Cases
What You Can Build with Code Tools
12 essential computation and data processing capabilities for your LLM agents.
Math Calculations
Perform complex arithmetic, formulas, and numeric scores.
Currency & Pricing
Calculate cart subtotals, tax rates, discounts, and order totals.
Shipping & Rates
Compute shipping costs dynamically based on zone and weight.
Data Formatting
Normalize phone numbers, format currency strings, and clean text.
Date & Time Parsing
Format timestamps, compute age, and calculate date differences.
Regex Parsing
Extract emails, policy numbers, order IDs, and regex matches.
Data Validation
Verify input schema, postal code formats, and required fields.
Array & Object Tools
Filter, map, reduce, and manipulate JSON structures.
Custom Business Rules
Apply proprietary company logic, tiers, and decision matrices.
Data Transformation
Reformat LLM payloads into downstream automation structures.
Conditional Logic
Execute multi-branch decision trees based on user properties.
String Manipulation
Sanitize HTML tags, truncate strings, and join text fragments.
Comparison
Code Tool vs Function Tool
Code Tools handle internal computation & formatting. Function Tools handle external APIs & network operations.
Internal Computation & Processing
Designed for JavaScript logic, math, date formatting, regex parsing, and JSON transformation inside the sandbox without network calls.
- Calculate order subtotal, shipping, & tax
- Format dates & sanitize string inputs
- Validate payload schema & regex patterns
External API & Network Operations
Designed for external REST API integration, CRM updates, booking appointments, and querying live external databases.
- Call CRM REST APIs (HubSpot, Salesforce)
- Book appointments & reserve calendar slots
- Retrieve live user records & order statuses
Frequently Asked Questions
Your competitors are already automating. Are you?
Stop wasting time switching between messaging apps. Omnisetu unifies WhatsApp, Instagram, Email, and every channel into one workspace — with 24/7 AI that qualifies leads and answers questions automatically.
No credit card required · 14-day free trial · Cancel anytime
