Structure
Basic Usage
Tools can be used in three main ways:config property and environment variables:
Inline Definitions
Tools can be defined inline using either TypeScript or Python code directly in your workflow. Each tool must export arun() function that contains the tool’s logic.
- TypeScript
- Python
Schema Definition
When creating a tool, you define three types of schemas:1
Configuration Schema
Defines the structure of the
config object2
Input Schema
Defines the structure of runtime parameters (used with
with)3
Output Schema
Defines the structure of the tool’s output
Key Points
Configuration Schema
The
config schema defines persistent configuration options that are set when the tool is initialized.Input & Output Schema
The
input and output schemas define runtime parameters and the tool’s output.Schema Format
Both configuration and input schemas use JSON Schema for validation and documentation.
Run Function Parameters
The
run() function receives both input and config parameters during execution.Required Fields
Required fields must be specified in the respective
required arrays within each schema definition.Best Practices
Tool Organization
- Use clear, descriptive tool IDs
- Group related tools together
- Document tool-specific configuration
Configuration Management
- Use environment variables for sensitive data
- Set sensible defaults in tool definitions
- Override only necessary config at usage points
Error Handling
- Always check tool error outputs
- Provide fallback behavior where appropriate
- Log tool execution metadata for debugging
Security
- Never expose sensitive credentials in tool code
- Validate and sanitize all inputs
- Follow security best practices for external services
References
- Deno Runtime - The JavaScript/TypeScript runtime used by Compozy
- Python Documentation - Official Python documentation
- JSON Schema - The schema format used for tool configuration and input/output
- Deno Standard Library - Built-in modules available for TypeScript tools
- Python Standard Library - Built-in modules available for Python tools
- JSR (JavaScript Registry) - Package registry for Deno modules
- PyPI - Python Package Index for Python modules