tensorone logo

Foundations

Graphs and Finite State Machines

We use graph structures and finite state machines to model agent behavior, decision flow, and recovery logic in complex multi-agent systems. This approach enables deterministic, auditable, and flexible execution flows.


Why Graphs and FSMs?

While LLMs can generate contextually rich responses, they lack built-in state awareness or planning memory. Graphs and FSMs provide:

  • Deterministic execution flows
  • Recovery checkpoints
  • Branching logic with conditional guards
  • Transparent and auditable decision paths

They allow agents to operate not just intelligently - but predictably and safely.


Key Concepts

Finite State Machines (FSMs)

FSMs are ideal for stepwise logic. They define:

  • States (e.g. idle, plan, act, verify)
  • Transitions between states
  • Guards (conditions that control transitions)
  • Entry/exit hooks (for validation, logging, etc.)

Use cases:

  • Prompt validation
  • Multi-phase reasoning (plan → verify)
  • Task lifecycle control

Directed Graphs

Directed Acyclic Graphs (DAGs) represent agent reasoning flows and delegation logic. They allow:

  • Parallel execution branches
  • Conditional backtracking and retries
  • Modular subtask routing

Example Flow:

Start → Plan → Research → Validate → Summarize → End
                    ↘︎ ↘︎
                  Critic  Fallback

This structure supports both forward progress and fail-safe detours.


Example: Research Pipeline Graph

    A[Start] --> B[Planner]
    B --> C[Researcher]
    C --> D[Critic]
    D --> E[Summarizer]
    D --> F[Replan?]
    F --> B
    E --> G[Finish]

This visual pipeline governs agent execution and error recovery. For example:

  • If the Critic flags a flaw, the agent may trigger a Replan
  • The flow restarts from Planner, preserving earlier context

Tools and Frameworks

We implement FSMs and DAGs with:

  • LangGraph – Graph-based flow control over LangChain
  • CrewAI – Agent team coordination with state modules
  • Graph compiler – Converts declarative YAML into live runtime logic
  • Eval hooks – Trace transitions and capture metrics for each node

Research Goals

We're actively exploring:

  • Self-modifying graphs: Agents restructure FSMs in real time
  • Heuristic triggers: Use uncertainty scores to condition transitions
  • State compression: Convert long history into reusable state tokens
  • Hybrid FSM × reactive agents: Combine strict logic with real-time adaptability

Why It Matters

In complex AI systems, how decisions are made is just as important as what decisions are made. Graphs and FSMs give us:

  • Simulation and testing for agent behavior
  • Visual maps of reasoning paths
  • Debugging tools for misaligned outputs -Guardrails for safe and repeatable execution
Previous
Agent2Agent (A2A) Protocol