Portal Community

1. Node-to-Node Data Passing

The most common ANCP pattern: one workflow execution node passes its output to the next node in the flow. The sending node packages its output as a Command payload and addresses it to the downstream node.

Scenario — Expense Approval Workflow

Data Transform → Approval Gate

A data-transform node has extracted expense data from a form submission. It sends a Command to the approval-gate node to begin the approval check.

// Step 1: Data Transform node sends Command to Approval Gate
{
  "id":              "cmd-dt-001",
  "type":            "Command",
  "source":          "node://tenant-acme/flow-42/data-transform",
  "destination":     "node://tenant-acme/flow-42/approval-gate",
  "tenantId":        "tenant-acme",
  "timestamp":       "2026-05-25T09:00:00.000Z",
  "protocolVersion": "1.0",
  "payload": {
    "action":      "processExpense",
    "expenseData": {
      "expenseId":  "EXP-9981",
      "employeeId": "E-1042",
      "amount":     750.00,
      "currency":   "USD",
      "category":   "travel",
      "receipts":   ["receipt-001.pdf"]
    },
    "workflowContext": {
      "flowId":    "flow-42",
      "runId":     "run-7712",
      "stepIndex": 2
    }
  }
}

// Step 2: Approval Gate processes and sends Command to Notify node
{
  "id":              "cmd-ag-001",
  "type":            "Command",
  "source":          "node://tenant-acme/flow-42/approval-gate",
  "destination":     "node://tenant-acme/flow-42/send-notification",
  "tenantId":        "tenant-acme",
  "timestamp":       "2026-05-25T09:00:01.200Z",
  "protocolVersion": "1.0",
  "payload": {
    "action":      "notifyApproval",
    "approved":    true,
    "approvedBy":  "manager-joe",
    "expenseId":   "EXP-9981"
  }
}

2. Agent Tool Call (Query/Response)

A workflow node needs to ask the Octopus AI agent to classify a document or make a policy decision. This follows the Query/Response pattern — the node sends a Query and waits for the Response.

Scenario — Document Classification

Workflow Node → Octopus Classifier Agent

An incoming-document node receives a PDF and needs the AI classifier agent to identify its type before routing it to the correct workflow branch.

// Step 1: Node sends Query to AI Classifier Agent
{
  "id":              "qry-doc-001",
  "type":            "Query",
  "source":          "node://tenant-acme/flow-88/incoming-doc",
  "destination":     "agent://tenant-acme/octopus/doc-classifier",
  "tenantId":        "tenant-acme",
  "timestamp":       "2026-05-25T10:00:00.000Z",
  "protocolVersion": "1.0",
  "correlationId":   "corr-doc-001",
  "replyTo":         "node://tenant-acme/flow-88/incoming-doc",
  "payload": {
    "query":      "classifyDocument",
    "documentId": "DOC-4421",
    "mimeType":   "application/pdf",
    "extractedText": "INVOICE\nDate: 2026-05-20\nAmount: $1,200.00..."
  }
}

// Step 2: Agent sends Response back
{
  "id":              "rsp-doc-001",
  "type":            "Response",
  "source":          "agent://tenant-acme/octopus/doc-classifier",
  "destination":     "node://tenant-acme/flow-88/incoming-doc",
  "tenantId":        "tenant-acme",
  "timestamp":       "2026-05-25T10:00:01.847Z",
  "protocolVersion": "1.0",
  "correlationId":   "corr-doc-001",
  "payload": {
    "status":    "success",
    "data": {
      "documentType":  "invoice",
      "confidence":    0.97,
      "subType":       "vendor-invoice",
      "suggestedRoute": "accounts-payable-flow",
      "extractedFields": {
        "invoiceDate":   "2026-05-20",
        "totalAmount":   1200.00,
        "vendorName":    "ACME Supplies Inc."
      }
    }
  }
}

3. EdgeStream Pub/Sub (Event Fan-Out)

When a workflow reaches a significant milestone, it publishes an ANCP Event to an EdgeStream topic. Multiple subscribers — the UI dashboard, an audit service, and a notification service — all receive the event independently.

Scenario — Workflow Completion Event

Flow Engine → Multiple Subscribers

An expense workflow completes successfully. The flow engine publishes a completion Event that triggers: (1) a UI update in the user's dashboard, (2) an audit log entry, and (3) a push notification.

// Event published by Flow Engine
{
  "id":              "evt-wf-001",
  "type":            "Event",
  "source":          "service://tenant-acme/flow-engine",
  "destination":     "topic://tenant-acme/workflow/completed",
  "tenantId":        "tenant-acme",
  "timestamp":       "2026-05-25T09:15:00.000Z",
  "protocolVersion": "1.0",
  "payload": {
    "workflowId":   "flow-42",
    "runId":        "run-7712",
    "status":       "completed",
    "outcome":      "approved",
    "durationMs":   14200,
    "completedAt":  "2026-05-25T09:15:00.000Z",
    "initiatedBy":  "user-88"
  }
}

// Subscriber 1: UI Dashboard (EdgeStream subscription)
stream.subscribe('topic://tenant-acme/workflow/completed', (envelope) => {
  dashboard.updateWorkflowStatus(envelope.payload.runId, 'Approved');
});

// Subscriber 2: Audit Service (EdgeStream subscription)
stream.subscribe('topic://tenant-acme/workflow/*', (envelope) => {
  auditLog.record(envelope);  // Matches all workflow events
});

// Subscriber 3: Notification Service
stream.subscribe('topic://tenant-acme/workflow/completed', (envelope) => {
  notificationService.sendPush(envelope.payload.initiatedBy, 'Expense approved!');
});

4. Human-in-the-Loop Suspension

When a workflow reaches an approval node that requires human input, ANCP carries the suspension and resume signals between the flow engine and the HIL system.

Scenario — HIL Approval Request

Approval Node → HIL System → Workflow Resume

An approval node suspends the workflow and sends an ANCP Command to the HIL service requesting a human decision. When the approver acts, the HIL service sends a Command back to the flow engine to resume.

// Step 1: Approval node suspends and requests human decision
{
  "id":              "cmd-hil-001",
  "type":            "Command",
  "source":          "node://tenant-acme/flow-42/approval-gate",
  "destination":     "service://tenant-acme/hil-service",
  "tenantId":        "tenant-acme",
  "timestamp":       "2026-05-25T09:05:00.000Z",
  "protocolVersion": "1.0",
  "correlationId":   "corr-hil-001",
  "replyTo":         "service://tenant-acme/flow-engine",
  "payload": {
    "action":       "requestApproval",
    "runId":        "run-7712",
    "suspendToken": "susp-abc123",
    "assignedTo":   ["manager-joe", "manager-alice"],
    "formId":       "approval-form-13002",
    "context":      { "expenseId": "EXP-9981", "amount": 750.00 },
    "deadline":     "2026-05-27T17:00:00.000Z"
  }
}

// Step 2: Manager approves; HIL service sends resume Command
{
  "id":              "cmd-resume-001",
  "type":            "Command",
  "source":          "service://tenant-acme/hil-service",
  "destination":     "service://tenant-acme/flow-engine",
  "tenantId":        "tenant-acme",
  "timestamp":       "2026-05-26T11:30:00.000Z",
  "protocolVersion": "1.0",
  "correlationId":   "corr-hil-001",
  "payload": {
    "action":       "resumeWorkflow",
    "runId":        "run-7712",
    "suspendToken": "susp-abc123",
    "decision":     "approved",
    "decidedBy":    "manager-joe",
    "comments":     "Approved — within policy limits"
  }
}

5. Real-Time Status Delivery to Browser

The flow engine publishes ANCP Events; EdgeStream delivers them via SignalR to the user's browser in real time. The browser subscribes to a topic scoped to its session and renders live status updates.

// Browser client subscribing to workflow status updates
const stream = createEdgeStream({ logLevel: 'info' });
await stream.start();

stream.subscribe(
  'signalr-server',
  `topic://tenant-acme/workflow/run-7712/*`,  // All events for this run
  (envelope) => {
    const { type, status, durationMs } = envelope.body.payload;
    updateProgressBar(status);
    addTimelineEntry(type, status, durationMs);
  }
);

Use Case Summary

Use CaseMessage TypeTransportKey Fields
Node-to-node output passingCommandIn-process / SignalRsource, destination, payload.action
AI agent tool callQuery + ResponseSignalR / HTTPcorrelationId, replyTo, payload.query
Workflow milestone eventEventEdgeStream pub/subdestination (topic://), payload.status
HIL suspension/resumeCommandHTTPcorrelationId, replyTo, payload.suspendToken
Real-time browser updatesEventSignalR → EdgeStreamdestination (topic://), sessionId
External webhook ingestionEventHTTP → ANCP bridgesource (service://), tenantId