Configuration

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

  • 1
    Define tools

    Create your tool functions in an entrypoint file (e.g., tools.ts)

  • 2
    Export functions

    Export as a default object with keys matching your workflow tool IDs

  • 3
    Configure runtime

    Set the entrypoint and permissions in your compozy.yaml

  • 4
    Execute tools

    Use the configured runtime to run tools within workflows

Quick Example

compozy.yaml
name: my-project
version: "1.0.0"

runtime:
  type: bun
  entrypoint: "./tools.ts"
  permissions:
    - --allow-read
    - --allow-net

Configuration Properties

PropertyDescriptionDefault
typeJavaScript runtime (currently only "bun" is supported)bun
entrypointPath to your tools file./tools.ts
permissionsSecurity 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.

tools.ts
// 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:

Permissions

When using the Bun runtime, you can control security permissions:

PermissionDescription
--allow-readFile system read access
--allow-writeFile system write access
--allow-netNetwork access
--allow-envEnvironment variable access

References