{
  "access": "public",
  "type": "reference",
  "format": "markdown",
  "title": "Semantic Workflows",
  "chunked": true,
  "url": "https://library.datagrout.ai/semantic-workflows",
  "summary": "Semantic workflows let you define multi-step workflows at a high level. The system handles type bridging, data enrichment, validation, and execution automatically.",
  "content_markdown": "# Semantic Workflows\n\nSemantic workflows let you define multi-step workflows at a high level. The system handles type bridging, data enrichment, validation, and execution automatically.\n\n## How It Works\n\nDescribe your goal in natural language. The system discovers relevant tools, identifies type mismatches, finds adapters, generates plans, validates them, and executes with monitoring.\n\n### Type Bridging\n\nWhen tools have incompatible schemas, the system automatically inserts adapters. For example, converting a CRM lead to a billing customer requires field mapping and type conversion—the system handles this automatically.\n\n### Hole Filling\n\nWhen data is missing required fields, the system enriches it automatically. It can look up missing information from external APIs, infer values from related fields, or prompt you for input when it can't fill gaps automatically.\n\n### Formal Verification\n\nEvery plan is verified before execution. The system checks for cycles, validates type compatibility, ensures policy compliance, and verifies all tools are available. Plans include Cognitive Trust Certificates (CTCs) proving correctness.\n\n### Skills\n\nSave verified workflows as reusable building blocks. Skills execute faster and cheaper than rebuilding workflows each time. Share skills across agents and teams.\n\n## Building Workflows\n\n### Using flow.into\n\nDefine workflows directly using the `flow.into` tool:\n\n```json\n{\n  \"goal\": \"Create invoice from Salesforce lead\",\n  \"lead_email\": \"user@example.com\"\n}\n```\n\nThe system generates a plan, validates it, and executes it automatically.\n\n### Using discovery.plan\n\nGenerate plans automatically from natural language goals:\n\n```json\n{\n  \"goal\": \"Create invoices for all qualified leads\",\n  \"policy\": {\"max_cost\": 100}\n}\n```\n\nThe discovery engine finds tools, plans the workflow, and returns a verified plan you can execute.\n\n### Interactive Playground\n\nUse the Playground to explore workflows interactively. Type your goal, review discovered plans, choose based on cost and safety, then execute and save as a skill.\n\n## Key Features\n\n### Automatic Adapter Insertion\n\nWhen types don't match, the system finds and inserts adapters automatically. You don't write transformation code.\n\n### Data Enrichment\n\nMissing fields are filled automatically through lookups, inference, or user prompts. The system handles enrichment strategies transparently.\n\n### Multi-Objective Optimization\n\nPlans are optimized across cost, latency, and risk. The system presents multiple options on the Pareto frontier—you choose based on your priorities.\n\n### Self-Healing\n\nWhen plans fail, the system attempts automatic recovery. It can insert missing adapters, enrich missing data, retry with backoff, or request approvals as needed.\n\n## Use Cases\n\n### Lead-to-Revenue Workflows\n\nConvert leads to invoices automatically. The system handles type conversions, data enrichment, multi-system coordination, and error handling.\n\n### Data Sync Across Systems\n\nKeep customer data synchronized between Salesforce, HubSpot, and internal databases. The system handles field mapping, conflict resolution, and partial failures.\n\n### Compliance Workflows\n\nGenerate reports that aggregate data from multiple systems, redact PII automatically, require approvals, and maintain audit trails.\n\n### Hybrid Cloud and On-Premise\n\nCreate workflows that span cloud integrations and on-premise systems via Private Connectors. The system routes requests transparently.\n\n## Monitoring\n\nView all workflow executions in the Runs tab. See plan structure, inputs, outputs, credits consumed, latency per step, errors, CTC references, and approval events.\n\nEvery execution generates a receipt showing estimated vs actual credits, breakdown by step, duration, and CTC reference.\n\n## Best Practices\n\nStart with discovery instead of hardcoding tool names. This makes workflows adapt if you switch integrations.\n\nUse skills for repeated workflows. First execution builds and validates the workflow. Subsequent executions use the skill, which is faster and cheaper.\n\nEnable approval gates for destructive operations. Configure approval channels and auto-approval rules in policy settings.\n\nMonitor credit consumption. Set budgets and track usage to prevent runaway costs.\n\nVersion your skills. When updating a skill, create a new version instead of overwriting. This enables rollback and A/B testing.\n\n## Troubleshooting\n\nIf no plan is found, check that required integrations are enabled and semantic types are annotated correctly. You may need to add a custom adapter.\n\nIf type mismatch occurs, verify tool annotations are correct. You may need an intermediate adapter or can use the generic type converter.\n\nIf plan validation fails, check the error message for specific violations. Fix policy issues or simplify the plan.\n\nIf approval is required but no channel is configured, set up an approval channel in policy settings.\n\nIf credits are insufficient, add credits, choose a cheaper plan, or optimize the workflow to remove unnecessary steps.\n"
}