dgi.synapse.build_dag ​
Construct layered DAG via topological sort
Construct a layered DAG from operations and their dependencies.
The fourth synapse. Uses deterministic topological sort to arrange operations into parallel layers, then uses AI for human-readable naming.
Inputs:
- operations: list from dgi.synapse.decompose (required)
- mappings: list from dgi.synapse.map_capabilities (required)
- parameter_flow: dict from decompose (required)
- understanding: dict from dgi.synapse.understand (required)
- all_missing_params: list from map_capabilities (required)
Outputs (terminal state_data):
- virtual_workflow: dict with name, summary, layers, edges, parameters
- input_tokens: int
- output_tokens: int
Plugin required: context.get_plugin("ai") — for naming only
Overview ​
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | App-dgi |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
connection_uuid | uuid | No | — | Explicit AI CloudConnection UUID — threaded to ai.chat.complete so synapse uses the org's resolved connection (org-context-free) |
model | string | No | — | Optional model override threaded to ai.chat.complete |
operations | json | Yes | — | Operations from decompose |
mappings | json | Yes | — | Mappings from map_capabilities |
parameter_flow | json | Yes | — | Parameter flow from decompose |
understanding | json | Yes | — | Understanding from understand |
all_missing_params | json | No | — | Missing params from map_capabilities |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
input_tokens | integer | No | — | — |
output_tokens | integer | No | — | — |
virtual_workflow | dict | No | — | — |
all_missing_params | json | No | — | — |
connection_uuid | uuid | No | — | — |
mappings | json | No | — | — |
model | string | No | — | — |
operations | json | No | — | — |
parameter_flow | json | No | — | — |
understanding | json | No | — | — |
failure_reason | string | No | — | — |
failure_type | string | No | — | — |
failed_action | string | No | — | — |
failed_at_state | string | No | — | — |
failed_step | string | No | — | — |
failed_layer | string | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | execute | — |
completed | No | Yes | Yes | — | — |
failed | No | Yes | No | — | — |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
pending | execute | completed | — |
* (any state) | fail | failed | — |
API Usage ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "dgi.synapse.build_dag",
"initial_data": {
"operations": "value",
"mappings": "value",
"parameter_flow": "value",
"understanding": "value"
}
}