Skip to main content

Addons & Actions

Table of Contents

Built-in Actions

The workflow engine includes several built-in actions. Built-in

Utility Actions

builtin::delay - Add delays to workflow execution

{
"id": "wait-step",
"action": "builtin::delay",
"parameters": {
"seconds": 30
}
}

builtin::log - Log messages with different levels

{
"id": "log-step",
"action": "builtin::log",
"parameters": {
"message": "Processing completed: {{result.status}}",
"level": "info"
}
}

builtin::transform - Transform data using templates

{
"id": "transform-step",
"action": "builtin::transform",
"parameters": {
"input": "{{api-response.output.data}}",
"rules": {
"processed_items": "{{input.items.map(item => item.name)}}",
"total_count": "{{input.items.length}}"
}
}
}

builtin::content_transform - Transform content between different types

The content_transform action provides comprehensive content transformation capabilities including encoding/decoding, format conversions, text operations, and data extractions.

Basic Usage

{
"id": "content-transform-step",
"action": "builtin::content_transform",
"parameters": {
"content": "{{payload.content}}",
"from_type": "text/plain",
"to_type": "base64"
}
}

Available Transformations

Encoding Transformations:

From TypeTo TypeDescription
base64text/plainDecode base64 to text
text/plainbase64Encode text to base64
base64application/octet-streamDecode base64 to binary
application/octet-streambase64Encode binary to base64
hextext/plainDecode hex to text
text/plainhexEncode text to hex
hexapplication/octet-streamDecode hex to binary
application/octet-streamhexEncode binary to hex
text/plainurl-encodedURL encode text
url-encodedtext/plainURL decode text
text/plainurl-encoded-plusURL encode with + for spaces
url-encoded-plustext/plainURL decode with + for spaces

Format Conversions:

From TypeTo TypeDescription
application/jsontext/plainConvert JSON to formatted text
text/plainapplication/jsonParse text to JSON
text/csvapplication/jsonParse CSV to JSON array
application/jsontext/csvConvert JSON array to CSV
text/htmltext/plainStrip HTML tags

Binary/Text Conversions (UTF-8):

From TypeTo TypeDescription
application/octet-streamtext/plain-utf8Decode binary as UTF-8 text
text/plainapplication/octet-stream-utf8Encode text as UTF-8 binary
text/plainascii-onlyStrip non-ASCII characters

Text Transformations:

From TypeTo TypeDescription
text/plainlowercaseConvert to lowercase
text/plainuppercaseConvert to UPPERCASE
text/plaintitlecaseConvert To Title Case
text/plaincapitalizeCapitalize first letter
text/plaintrimmedTrim whitespace from both ends
text/plainltrimmedTrim whitespace from left
text/plainrtrimmedTrim whitespace from right

Newline Normalization:

From TypeTo TypeDescription
text/plainunix-newlinesConvert to Unix newlines (LF)
text/plainwindows-newlinesConvert to Windows newlines (CRLF)
text/plainmac-newlinesConvert to Mac newlines (CR)

Data Extraction:

From TypeTo TypeDescription
text/plainnumbersExtract all numbers
text/plainemailsExtract email addresses
text/plainurlsExtract URLs

Date/Time Conversions:

From TypeTo TypeDescription
timestampiso8601Convert Unix timestamp to ISO 8601
iso8601timestampConvert ISO 8601 to Unix timestamp

Examples

Base64 Encoding:

{
"id": "encode-base64",
"action": "builtin::content_transform",
"parameters": {
"content": "Hello World",
"from_type": "text/plain",
"to_type": "base64"
}
}

CSV to JSON:

{
"id": "csv-to-json",
"action": "builtin::content_transform",
"parameters": {
"content": "name,age\nJohn,30\nJane,25",
"from_type": "text/csv",
"to_type": "application/json"
}
}

Extract Emails:

{
"id": "extract-emails",
"action": "builtin::content_transform",
"parameters": {
"content": "Contact us at support@example.com or sales@example.com",
"from_type": "text/plain",
"to_type": "emails"
}
}

Timestamp Conversion:

{
"id": "timestamp-to-iso",
"action": "builtin::content_transform",
"parameters": {
"content": "1609459200",
"from_type": "timestamp",
"to_type": "iso8601"
}
}

URL Encoding:

{
"id": "url-encode",
"action": "builtin::content_transform",
"parameters": {
"content": "hello world & stuff",
"from_type": "text/plain",
"to_type": "url-encoded"
}
}

Binary to UTF-8 Text:

{
"id": "decode-binary",
"action": "builtin::content_transform",
"parameters": {
"content": "{{binary_data}}",
"from_type": "application/octet-stream",
"to_type": "text/plain-utf8"
}
}

Strip Non-ASCII Characters:

{
"id": "ascii-only",
"action": "builtin::content_transform",
"parameters": {
"content": "Hello 世界 World",
"from_type": "text/plain",
"to_type": "ascii-only"
}
}

Note: HTML tag removal uses simple regex and may not handle complex HTML with nested tags or embedded scripts. For production use with complex HTML, consider using a dedicated HTML parsing addon.

builtin::content_validate - Validate content against its declared type

{
"id": "content-validate-step",
"action": "builtin::content_validate",
"parameters": {
"content": "{{payload.content}}",
"type": "{{payload.type}}"
}
}

builtin::chunk_text - Chunk text for RAG and embedding workflows

Split text into chunks using LlamaIndex SentenceSplitter, ideal for preparing documents for embeddings and RAG workflows.

{
"id": "chunk-document",
"action": "builtin::chunk_text",
"parameters": {
"text": "{{document.content}}",
"chunk_size": 1024,
"chunk_overlap": 200,
"separator": " ",
"paragraph_separator": "\n\n\n"
}
}

Parameters:

  • text (required): The text content to chunk
  • chunk_size (optional, default: 1024): Maximum size of each chunk in characters
  • chunk_overlap (optional, default: 200): Number of characters to overlap between chunks
  • separator (optional, default: " "): Word separator for splitting
  • paragraph_separator (optional, default: "\n\n\n"): Paragraph boundary separator

Returns:

{
"chunks": ["chunk1", "chunk2", "..."],
"count": 5,
"chunk_size": 1024,
"chunk_overlap": 200,
"success": true
}

Logic Actions

logic::if - Conditional logic evaluation

{
"id": "conditional-step",
"action": "logic::if",
"parameters": {
"condition": "{{user.premium}} == true",
"then": "premium-processing",
"else": "standard-processing"
}
}

logic::loop - Iterate over collections

{
"id": "loop-step",
"action": "logic::loop",
"parameters": {
"items": "{{data.collection}}"
}
}

Loop Variables Available:

  • {{loop_item}} - Current item being processed
  • {{loop_index}} - Current iteration index (0-based)

Loop Example:

{
"id": "process-items",
"action": "logic::loop",
"parameters": {
"items": ["item1", "item2", "item3"]
}
}

Multiple Addon Instances

You can configure multiple instances of the same addon type with different configurations:

{
"addons": [
{
"id": "openai-gpt4",
"type": "openai",
"name": "OpenAI GPT-4",
"enabled": true,
"config": {
"model": "gpt-4",
"temperature": 0.7
},
"secrets": {
"api_key": "OPENAI_API_KEY"
}
},
{
"id": "openai-gpt35",
"type": "openai",
"name": "OpenAI GPT-3.5",
"enabled": true,
"config": {
"model": "gpt-3.5-turbo",
"temperature": 0.3
},
"secrets": {
"api_key": "OPENAI_API_KEY"
}
}
]
}

Using Addon Actions

Use the addon ID in action names to choose which addon instance to use:

{
"id": "generate-creative-text",
"action": "openai-gpt4::completion",
"parameters": {
"prompt": "Write a creative story about {{topic}}",
"max_tokens": 500
}
},
{
"id": "generate-summary",
"action": "openai-gpt35::completion",
"parameters": {
"prompt": "Summarize: {{content}}",
"max_tokens": 100
}
}

Backward Compatibility

Legacy addon-type::action format still works but shows deprecation warnings:

{
"id": "legacy-action",
"action": "openai::completion"
}

Warning: If multiple instances of the same type exist, legacy format will use the last loaded instance.

Addon Configuration

Configure addons with secrets management:

{
"addons": [
{
"id": "database-addon",
"type": "postgres",
"enabled": true,
"config": {
"host": "localhost",
"port": 5432,
"database": "myapp"
},
"secrets": {
"username": "DB_USER",
"password": "DB_PASSWORD",
"api_key": "POSTGRES_API_KEY"
}
}
]
}

Set up environment variables or .env file, we will also make available differents vault later with a flow that will try various source to get your secrets safely.

# .env file
DB_USER=postgres_user
DB_PASSWORD=secure_password
POSTGRES_API_KEY=your_api_key_here

Custom Addons

To create custom addons, refer to the Rooms Template Package