Portal Community

Result Flow

1
Agent calls start_workflow in sync mode The agent's reasoning loop pauses at the tool call, waiting for the result.
2
Octopus polls ProcessServer for completion Polls every 2 seconds up to SyncTimeoutSeconds. The SSE stream shows a "Processing..." indicator.
3
Workflow output returned as tool result JSON The workflow's final output dictionary is serialised to JSON and returned as the tool result.
4
Agent synthesises a response The LLM receives the tool result in context and generates a natural language response for the user.
5
Result stored in episodic memory The tool call, result, and agent response are all saved as episode messages for future recall.

Example: Successful Workflow Result

// Tool result passed to the LLM after workflow completes
{
  "execution_id":   "exec-abc123",
  "workflow_id":    "leave-approval-workflow",
  "status":         "Completed",
  "elapsed_ms":     4250,
  "outputs": {
    "request_id":   "LR-8821",
    "status":       "Submitted",
    "approver":     "alice.manager@company.com",
    "due_date":     "2024-06-17",
    "submitted_at": "2024-06-15T10:00:04Z"
  }
}

// Agent response (synthesised from result):
"Your leave request has been submitted successfully 🎉
Reference: LR-8821
Approver:  Alice Manager (alice.manager@company.com)
Decision due: June 17, 2024

You'll receive an email notification when a decision is made."

Example: Workflow Failure

// Workflow failed during execution
{
  "execution_id": "exec-xyz456",
  "workflow_id":  "leave-approval-workflow",
  "status":       "Failed",
  "error": {
    "code":    "INSUFFICIENT_LEAVE_BALANCE",
    "message": "Employee EMP-1234 has only 3 annual leave days remaining; requested 5."
  }
}

// Agent response:
"I wasn't able to submit your leave request. Your current annual leave balance is
only 3 days, but you requested 5 days. Would you like to adjust the dates, or
apply for a combination of annual and unpaid leave?"

Async Result Retrieval

For async-mode workflows, the agent returns the execution ID to the user. The user can ask the agent to check status later:

// User follow-up: "What happened with my leave request?"
// Agent uses get_workflow_status tool (also registered by ProcessPlugin)

// get_workflow_status tool call
{ "execution_id": "exec-abc123" }

// Response:
{
  "execution_id": "exec-abc123",
  "status":       "Completed",
  "outputs":      { "status": "Approved", "approved_by": "Alice Manager" }
}