Task Execution Behavior
Understanding how tasks execute is essential for building reliable automation workflows. When a task runs—whether triggered manually or by its schedule—the platform orchestrates a sophisticated execution process that manages conversations, tracks progress, and generates detailed execution summaries.
Execution Lifecycle
Each task execution follows a well-defined lifecycle that ensures reliable operation and comprehensive tracking:
-
Initialization: The system validates the task exists and checks that your account has sufficient conversation quota. If the task is already running, the new execution request is gracefully ignored to prevent duplicate runs.
-
Session Management: The platform either creates a new conversation or reuses an existing session based on the task's
sessionDurationconfiguration. Sessions are cached and reused within the configured duration, allowing multi-step workflows to maintain context across executions. -
Context Injection: Before the bot begins processing, the system injects current task details and information about the previous execution (if any) into the conversation. This provides the bot with essential context including the task name, description, metadata, and a summary of what happened in the last run.
-
Bot Processing: The associated bot receives the task instructions and executes its configured workflow. The bot has access to all its abilities, skillsets, and integrations during this phase.
-
Completion and Summary: After the bot finishes processing, the system automatically generates a detailed execution summary capturing key actions taken, outcomes achieved, and relevant context for future executions.
Session Persistence
Task sessions provide continuity between executions, enabling sophisticated multi-step workflows:
-
Session Duration: Controlled by the
sessionDurationparameter (in milliseconds), this determines how long a conversation session remains active between executions. Sessions lasting at least 60 seconds are cached for reuse. -
Session Reuse: When a task executes within an active session window, it continues the existing conversation rather than starting fresh. This allows the bot to reference previous messages and maintain workflow state.
-
New Sessions: When the session expires or doesn't exist, a new conversation is created with the task's name and description. The conversation is automatically associated with the task and any configured contact.
Execution Context
Each execution receives rich context to enable intelligent processing:
-
Task Details: The bot receives the task's name, description, and any custom metadata you've configured. This allows you to pass dynamic parameters or configuration to your automation workflows.
-
Previous Execution Summary: If the task has run before, the bot receives a summary of the last execution including its outcome, completion time, and a detailed summary of actions taken. This enables workflows that build upon previous results or handle incremental processing.
-
Execution Tracking: Every execution creates a record that captures the start time, completion time, outcome (success or failure), and a generated summary. These records provide a complete audit trail of your automation activity.
Execution Outcomes
Task executions result in one of the following outcomes:
-
Success: The bot completed its workflow without errors. The execution summary captures what was accomplished, and the task status returns to idle.
-
Failure: An error occurred during execution. The system captures the failure, updates the execution record, and returns the task to idle status. Failed executions don't prevent future scheduled runs.
-
Skipped: If the task is already running when a new execution is requested, the duplicate request is silently ignored. This prevents overlapping executions that could cause conflicts or resource contention.
Automatic Summary Generation
After each successful execution, the platform automatically generates a comprehensive summary that includes:
- Key steps taken and actions performed during the execution
- Important outcomes and results achieved
- Any data retrieved or generated by the bot
- Decisions made and the reasoning behind them
- Issues encountered and how they were resolved
- Current state and context relevant for the next execution
These summaries are stored with the execution record and provided to subsequent executions, enabling workflows that maintain awareness of their history and can make informed decisions based on past results.
Concurrency and Rate Limiting
The task execution system includes built-in protections:
-
Single Execution: Only one instance of a task can run at a time. Concurrent trigger requests for the same task are deduplicated within a one-minute window.
-
Account Limits: Executions are subject to your account's conversation limits. If limits are exceeded, the execution will not proceed and an appropriate error is returned.
-
Graceful Handling: The system handles edge cases like missing bots, expired sessions, and transient errors without corrupting task state.
Best Practices
To build reliable task automations:
-
Configure Appropriate Session Duration: Use longer sessions for multi-step workflows that need context continuity, and shorter sessions for independent operations that should start fresh each time.
-
Design for Idempotency: Since tasks may occasionally be triggered multiple times (e.g., manual trigger during scheduled run), design your bot workflows to handle duplicate executions gracefully.
-
Leverage Previous Execution Context: Use the previous execution summary to implement incremental processing, avoid repeating completed work, or handle recovery from previous failures.
-
Monitor Execution Records: Review task execution history to identify patterns, troubleshoot failures, and optimize your automation workflows based on actual performance data.