Runtime
The runtime is the component responsible for executing your custom JavaScript/TypeScript tools within Compozy workflows. It provides a secure, sandboxed environment using Bun to run your tool functions.
How It Works
- 1Define tools
Create your tool functions in an entrypoint file (e.g.,
tools.ts
) - 2Export functions
Export as a default object with keys matching your workflow tool IDs
- 3Configure runtime
Set the entrypoint and permissions in your
compozy.yaml
- 4Execute tools
Use the configured runtime to run tools within workflows
Quick Example
name: my-project
version: "1.0.0"
runtime:
type: bun
entrypoint: "./tools.ts"
permissions:
- --allow-read
- --allow-net
Configuration Properties
Property | Description | Default |
---|---|---|
type | JavaScript runtime (currently only "bun" is supported) | bun |
entrypoint | Path to your tools file | ./tools.ts |
permissions | Security permissions for Bun runtime | ["--allow-read"] |
For detailed schema information and all available options, see the Runtime Schema.
The Entrypoint File
The entrypoint file (typically tools.ts
) is where you define your custom tool functions. Each function receives parameters and returns data that can be used in your workflows.
// Define your tool functions
async function fetchData(params: { url: string }) {
const response = await fetch(params.url);
return await response.json();
}
// Export functions with keys matching workflow tool IDs
export default {
fetch_data: fetchData, // Key "fetch_data" must match tool ID in workflow
};
Learn more about tool development:
- TypeScript Tool Development - Complete guide to building tools
Permissions
When using the Bun runtime, you can control security permissions:
Permission | Description |
---|---|
--allow-read | File system read access |
--allow-write | File system write access |
--allow-net | Network access |
--allow-env | Environment variable access |
References
Providers
Configure LLM providers to enable AI agents to interact with various language models. Compozy supports 8 providers with distinct capabilities and configuration requirements.
Workflow
Configure workflow-level settings including inputs, outputs, triggers, scheduling, and environment variables in Compozy