Implementing Control Graphs for Reliable AI Agents

AI Jasongo watch the original →

Reliability in AI agents is achieved by shifting from simple prompting to 'control graphs'—structured workflows that use either code-based primitives or documented SOPs to manage agent nodes, state, and verification.

The Shift to Control Graphs

Modern agent development is moving away from human-in-the-loop prompting toward automated, reliable workflows. The author identifies three distinct concepts often conflated as 'graph engineering': control graphs (SOP-driven workflows), knowledge graphs (data relationship mapping), and graphs of loops (multi-agent systems). The primary focus for production reliability is the control graph, which manages agent execution through nodes (actions), edges (transitions), and state (persisted data).

Implementation Strategies

There are two primary methods for enforcing these control graphs:

  • Large Language Model as Graph: This approach uses documented Standard Operating Procedures (SOPs) provided as context or skills. The agent follows a predefined text-based or JSON-based workflow. For example, the author uses a 'daily bad design triage' loop where an agent executes a series of heuristic scripts, fans out sub-agents for vision-based evaluation, and ranks results based on a predefined schema.
  • Code as Graph: This method uses programmatic primitives (e.g., agent, pipeline, parallel) to define workflows in JavaScript. This is preferred for complex tasks requiring deterministic data fetching, end-to-end testing, or strict input/output contracts between nodes. The author uses this for a 'ship change' workflow that breaks tasks into setup, implementation, and verification phases.

Design Patterns for Reliability

To ensure these graphs perform consistently, developers should implement the following patterns:

  • Boundary Separation: Do not overload a single agent node. Separate 'planner' agents from 'executor' agents and 'verifier' agents to maintain focus and improve performance.
  • State Persistence: Maintain a central artifact store, such as a markdown file or an append-only log, to track the current status of the work across all agent nodes.
  • Deterministic Guardrails: Use code-based scripts for common, repeatable tasks like data fetching or dev server management to prevent agents from wasting cycles on environment setup.
  • Output Contracts: Define strict input and output schemas for every agent node to ensure the next node in the graph receives predictable data.
  • #ai
  • #dev-tooling
  • #agents

summary by google/gemini-3.1-flash-lite. probably wrong about something. check the source.