Skip to main content

What is Declare Task Succeeded?

Declare Task Succeeded is a specialized tool that allows a focused action agent to immediately terminate workflow execution with a success status when specific success conditions are met. In production, this is an explicit opt-in tool: wire it into a focused_action prompt only when you want that focused action to be allowed to end the entire workflow early.
In your prompts, always refer to this tool as declare_task_succeeded (lowercase, with underscores).
Focused Action Only: This tool is only available within focused_action. The main agent and recovery agent can already signal success by completing their task normally (sending a final message without a tool call). Use declare_task_succeeded only when your workflow instructions explicitly tell the focused action to call declare_task_succeeded if a named success condition is met.
Think of declare_task_succeeded as an early-exit switch that you intentionally wire into a focused action prompt, not as a general “the agent can decide to stop whenever it thinks the task is done” behavior.

Why This Tool Exists

During cached workflow replay, the main agent is not invoked—actions are replayed deterministically from the trajectory. However, focused_action always runs dynamically, even during cached runs. This creates situations where:
  • A focused action discovers the task is already complete (e.g., data was already processed)
  • A user-defined success condition is met earlier than expected
  • The focused action determines no further steps are needed
Without declare_task_succeeded, the focused action would return to the trajectory replay, which would continue executing remaining steps unnecessarily.

How It Works

  1. A focused action evaluates the current screen state
  2. Your prompt tells that focused action exactly when it should call declare_task_succeeded
  3. If that success condition is met, it calls declare_task_succeeded (optionally with a description of why)
  4. Workflow execution immediately terminates with success status
  5. Trajectories are committed (the successful path is saved)
  6. Post-run Checks run normally, unless the focused action called declare_task_succeeded with skip_post_run_checks=True
  7. Normal success cleanup occurs (status update, webhooks, etc.)
The text parameter is optional. If omitted, a default “Task completed successfully” message is used.
declare_task_succeeded also accepts skip_post_run_checks=True. Use this only when the prompt explicitly says the early-success path should skip Post-run Checks, such as when the task was already complete before the workflow produced the attachments or output data that those checks normally verify.
Unlike declare_task_failed which clears pending trajectories, declare_task_succeeded commits them because the workflow reached a valid success state.
Explicit success still goes through the normal terminal output-processing path. If a workflow promises structured output_data and that final transformation fails, Cyberdesk preserves the pending trajectories but surfaces the run as error instead of silently returning success with missing output.

When to Use Declare Task Succeeded

1. Early Success Detection

When a focused action discovers the goal is already achieved and your prompt explicitly allows early success:

2. Conditional Workflow Completion

When success depends on dynamic content evaluation and you want the focused action to end the run immediately:

3. Goal-Based Termination

When the focused action can determine the workflow’s goal is met and you have explicitly granted it permission to stop the run:

How to Prompt for Task Success

Best Practices

  1. Be Specific: Clearly define what constitutes success
  2. Explain the Condition: Describe what the focused action should look for
  3. Write the Exact Tool Name: Include the literal phrase declare_task_succeeded in the prompt when you want to enable this behavior
  4. Include Context: Specify what message to include when succeeding
  5. Use in Focused Actions: Remember this is only for dynamic success detection

Prompt Template

Skipping Post-run Checks

If your workflow has Post-run Checks that only make sense after the normal path creates files, screenshots, or structured output, tell the focused action to use skip_post_run_checks=True only for the early-success case:
When this parameter is set, Cyberdesk marks each configured Post-run Check as success and records a message explaining that it was skipped because declare_task_succeeded was called with skip_post_run_checks=True. Cyberdesk also does not generate a reusable trajectory for that early-success path, since it represents an idempotent shortcut rather than the workflow’s normal repeatable path.

Real-World Examples

Healthcare: Record Already Updated

Finance: Transaction Already Processed

E-commerce: Order Already Fulfilled

IT Operations: System Already Configured

Comparison: declare_task_succeeded vs declare_task_failed

Integration with Cached Workflows

This tool is particularly valuable in cached workflows where you want a dynamically evaluated focused_action check to have permission to end the run:
During cached replay, the focused action will dynamically evaluate step 2 and can terminate the workflow early if the order is already complete, preventing unnecessary cached actions from executing.

Common Patterns

Pre-flight Success Check

Polling with Success Detection

Idempotent Operations

Common Mistakes to Avoid

Don’t use declare_task_succeeded for:
  • Normal workflow completion (just let the workflow end naturally)
  • Main agent success detection (the main agent completes by sending a final message)
  • Cases where the prompt never explicitly asked for declare_task_succeeded
  • Partial success (if more steps are needed, don’t terminate early)

Incorrect Usage

Correct Usage

Best Practices Summary

  1. Use only within focused_action - This is the key constraint
  2. Explicitly include declare_task_succeeded in the instructions - The focused action should not infer this behavior on its own
  3. Define clear success conditions - Be specific about what “success” means
  4. Consider adding descriptive messages - Optionally explain why the workflow succeeded (helps debugging)
  5. Consider idempotency - Great for workflows that should be safe to re-run
  6. Pair with declare_task_failed - Handle both success and failure conditions
  7. Think about cached replay - Most valuable when focused actions run during trajectory replay