Skip to content

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:

Workflow Graph Structure
Approved Query Query Plan Step 1 Step 2 Step 3 Tool A Tool B ANSWERED_BY SIMILAR_TO FIRST_STEP HAS_STEP HAS_STEP HAS_STEP NEXT_STEP NEXT_STEP USES_TOOL USES_TOOL USES_TOOL
Node TypeWhat It Stores
QueryUser queries with vector embeddings for similarity matching, risk level, and classification
WorkflowMulti-step workflow templates: a named, categorised sequence of steps with a state schema
StepIndividual operations: a prompt mask, input/output mappings, step number, and a reference to the tool it uses
ToolRegistered 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:

ConditionEffect
Strong, confident matchReuses the proven plan directly
Multiple possible matchesPlanner considers options and adapts
No matchPlanner creates a novel plan from scratch
High-risk query, no proven templateDeclines execution for safety

Workflow Lifecycle

Workflows follow a managed lifecycle:

  1. A novel query is successfully answered through AIM’s plan-execute-review loop
  2. The successful plan is automatically saved as a workflow template
  3. Future similar queries match via similarity search
  4. The planner uses the template, adapting it to the specific new query
  5. 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.