Skip to main content

Structure

  • Action.py β€” Implementation.
  • README β€” Purpose, I/O, examples.
  • requirements.txt β€” Pure‑Python dependencies (no binary installs).

Contract

  • Inputs β€” Typed, minimal, documented.
  • Outputs β€” Deterministic structure; document edge cases.

Workflow

  1. Define input/output and write Action.py.
  2. Pin dependencies in requirements.txt.
  3. Test with small Payloads via Execute.
  4. Reuse across Flows and as Agent tools.

Loop Support

Actions now support iterative execution with loops:
  • For loops β€” Iterate over collections and lists
  • While loops β€” Continue until a condition is met
  • Loop state management β€” Proper handling of iteration context and variables
This allows Actions to handle batch processing, repeated operations, and conditional iterations natively.

OAuth Integration

Actions can access OAuth credentials for third-party API integrations:
from triform import get_oauth_token

def my_action(data: dict) -> dict:
    # Access OAuth token configured via modifiers
    token = get_oauth_token('google')
    
    # Use in API requests
    headers = {'Authorization': f'Bearer {token.access_token}'}
    response = requests.get('https://api.example.com/data', headers=headers)
    
    return response.json()
Supported features:
  • Automatic token refresh before expiration
  • Secure credential injection at runtime
  • Multi-provider support (Google, GitHub, Slack, Microsoft, etc.)
  • Token management handled by the platform
See Modifiers for configuring OAuth credentials.

File Storage

Actions can save and retrieve files using the Storage system:
from triform import save_file, get_file

def process_document(data: dict) -> dict:
    # Save a generated file
    report_path = save_file(
        filename="report.pdf",
        content=generate_pdf(data),
        content_type="application/pdf"
    )
    
    # Retrieve a file
    template = get_file(data["template_path"])
    
    return {"report": report_path}
Available functions:
  • save_file(filename, content, content_type) β€” Store a file
  • get_file(path) β€” Retrieve a file’s content
See Storage for complete documentation.
warning: Dependencies β€” Only packages that do not require binary installs in the build image are supported.