Runtime
Every tool on Rival runs inside one of three runtimes: Python, JavaScript, or Lua. The runtime you choose determines the language your handler is written in, how fast it starts, and what libraries are available. You select it during the Basic Info step of the tool builder, and it cannot be changed after the tool is created.
Python
Python is the most capable runtime on Rival. It gives you access to the full Python package ecosystem - NumPy, Pandas, Requests, OpenAI, and anything else you can install via pip. If your tool needs data processing, machine learning inference, HTTP clients, or complex logic that benefits from a mature library ecosystem, Python is the right choice.
The trade-off is startup time. Python tools install their dependencies at runtime, which means the first execution after a cold start takes longer than JavaScript or Lua. For tools that are called infrequently or where latency is not critical, this is rarely a problem. For high-frequency, low-latency use cases, JavaScript or Lua will serve you better.
Dependencies are declared in a requirements.txt file alongside your handler. Rival reads that file and installs the listed packages before your code runs. Your main handler file must be named cortexone_function.py and must export a function called cortexone_handler.
Choose Python when:
- Your tool relies on third-party libraries (ML models, data manipulation, API clients)
- Execution speed is less important than capability
- Your team is most productive in Python
JavaScript
The JavaScript runtime runs on V8, the same engine that powers modern browsers. It starts fast, executes fast, and is well-suited for tools that need low latency without complex dependencies.
JavaScript on Rival runs synchronously - async/await and Promises are not supported. If your tool logic is straightforward and does not need to await I/O, this is not a limitation. If you need to make HTTP requests or do I/O-bound work, Python is the better fit.
There is no package manager available in the JavaScript runtime. You write self-contained handler code without import or require from external modules. The standard JavaScript built-ins are fully available.
Choose JavaScript when:
- You need fast, low-latency execution
- Your tool logic is self-contained and does not require external packages
- You are comfortable writing synchronous code
Lua
Lua is the lightest runtime on Rival. It starts nearly instantly and has a minimal footprint, making it ideal for simple transformation, formatting, or logic tasks where raw speed matters.
Lua runs in a sandboxed environment with access to its standard library. Like JavaScript, it runs synchronously and has no package manager. It is best suited for tools that do focused, deterministic work - string manipulation, data reshaping, rule evaluation - without needing external services or libraries.
Choose Lua when:
- Your tool does simple, fast, deterministic computation
- You want the lowest possible execution overhead
- You are comfortable with Lua’s syntax and standard library
Comparing the runtimes
| Python | JavaScript | Lua | |
|---|---|---|---|
| Startup speed | Slower (dependency install) | Fast | Fast |
| External packages | Yes, via requirements.txt | No | No |
| Async support | Yes | No | No |
| Best for | Data, ML, API integrations | Fast logic, transformations | Lightweight, deterministic tasks |
Changing the runtime
The runtime is locked to the tool at creation time. If you need to switch languages, you will need to create a new tool. This is by design - it keeps versioning clean and ensures that callers relying on a tool’s behavior are not surprised by underlying changes.