Actions
Atomic Python units: structure, contracts, workflow
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
- Define input/output and write
Action.py. - Pin dependencies in
requirements.txt. - Test with small Payloads via Execute.
- 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_tokendef 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_filedef 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 fileget_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.
Was this helpful?
More in Core Concepts
ProjectsExecutionsPayloadsTriggersStill need help? Ask the team