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:
Here’s an example of a tool definition:
Key Points
Configuration Schema
The
config schema defines persistent configuration options that are set when the tool is initialized.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.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
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