Workflows
Workflows are Squad’s procedural memory: the slowest-learning and highest-confidence layer of the memory architecture. They represent proven patterns for accomplishing tasks, stored as structured graphs that can be retrieved, matched, and executed automatically.
Just as the basal ganglia encode motor sequences you no longer need to think about, the workflow graph encodes proven operational patterns that Squad can execute without deliberation. New procedures only enter this graph after explicit human approval, ensuring that procedural memory represents validated, trusted knowledge.
The Workflow Graph
Workflows are stored as a connected graph of four node types:
| Node Type | What It Stores |
|---|---|
| Query | User queries with vector embeddings for similarity matching, risk level, and classification |
| Workflow | Multi-step workflow templates: a named, categorised sequence of steps with a state schema |
| Step | Individual operations: a prompt mask, input/output mappings, step number, and a reference to the tool it uses |
| Tool | Registered capabilities: name, description, parameter schema, and a reference to the implementation |
Steps and Tools
Each Step carries a prompt (the instruction mask) and inputs/outputs (JSON mappings that wire data between steps). Steps are ordered via NEXT_STEP relationships, which can carry conditions for branching logic.
Each Step references a Tool via USES_TOOL, with an optional tool_config for step-specific overrides (e.g., a specific sheet name or date format). Tools are reusable across workflows: the same tool can appear in many different workflows.
Query Matching and Few-Shot Learning
Approved queries carry vector embeddings that enable similarity search. When a new query arrives, AIM searches for similar approved queries. High-confidence matches allow the system to reuse a proven workflow directly.
Successful query-answer pairs can also be promoted into few-shot examples: stored prompts that are attached to steps and used to guide future execution. This is how the system builds up domain-specific knowledge at the step level, not just the workflow level.
How Workflows Are Created
Pre-defined Workflows
Your Squad instance comes with a baseline set of workflow templates tailored to your use case. These provide proven starting points that the system can adapt to specific queries.
Learned Workflows
When Squad successfully answers a novel query: one that didn’t match any existing template: the successful plan is automatically saved as a new workflow template with a vector embedding for future similarity matching. The next time a similar question is asked, Squad will match it to this learned workflow.
Tool Creation
When AIM’s Explorer identifies a capability gap: a task that no existing tool can handle: it can generate new tools. After human approval, these tools are registered in the graph and immediately available to any workflow. This is how Squad’s capability set grows from real usage.
Workflow Matching
When a new query arrives, Squad searches for similar approved workflows:
| Condition | Effect |
|---|---|
| Strong, confident match | Reuses the proven plan directly |
| Multiple possible matches | Planner considers options and adapts |
| No match | Planner creates a novel plan from scratch |
| High-risk query, no proven template | Declines execution for safety |
Workflow Lifecycle
Workflows follow a managed lifecycle:
- A novel query is successfully answered through AIM’s plan-execute-review loop
- The successful plan is automatically saved as a workflow template
- Future similar queries match via similarity search
- The planner uses the template, adapting it to the specific new query
- Administrators can review, revoke, or restore workflow templates via the Tune page
Over time, individual steps within workflows can be progressively hardened: graduating from expensive AI reasoning to fast, deterministic execution as patterns stabilise.
Related
- Executing Workflows: how stored workflows become live executions
- Accuracy & Disambiguation: how template reuse is governed
- Memory Architecture: the broader memory system workflows belong to
- Query Curation: managing approved queries and workflows via the Tune page
- Guardrails & Safety: security controls throughout workflow execution