85 agentic tools audited for security incidents · Talk to the lab →
MotionticBook a call
Glossary

What is an agent graph?

An agent graph is a way of defining an AI agent system as nodes, which are model calls, tools or code steps, joined by edges that fix or conditionally choose what runs next, with shared state passed between them.

A plain agent loop lets the model decide every next step. A graph writes the possible paths down. Each node does one piece of work and returns an update to a shared state; each edge says which node runs next, either always or based on a condition. The graph can still call a model at any node, so it mixes fixed routing with model judgement where needed.

LangGraph is the most widely known example, and the idea has spread. Microsoft Agent Framework 1.0 (April 2026) ships a stable graph workflow engine, and Google added graph workflows to ADK 2.0, arguing in July 2026 that routing known steps through a model loop is slow, costly and prone to derailing.

How a graph runs, using LangGraph's terms

  • State

    A typed object shared by all nodes. Each field has a reducer that decides how updates merge, such as replacing a value or appending to a list.

  • Nodes

    Functions that read the state and return partial updates. A node can call a model, run a tool or execute plain code.

  • Edges

    Normal edges always lead to the next node; conditional edges run a routing function to choose. A node with several outgoing edges triggers them in parallel.

  • Super-steps

    Execution is inspired by Google's Pregel system: in each super-step, active nodes run, nodes in the same step run in parallel, and the run ends when no messages remain.

  • Checkpoints and limits

    Checkpointers save state between super-steps so runs can pause and resume, and a recursion limit stops a graph that loops too long.

The case for and against graphs

Google's ADK 2.0 post makes the case for: in its illustrative refund example, a graph with code routing used about half the tokens and about 20% less latency than a model-led loop, and a manipulated model node cannot trigger an action that has no node or edge in the graph.

OpenAI's practical guide (April 2025) makes the case against declarative graphs: defining every branch, loop and condition up front helps visually but becomes cumbersome as workflows grow more dynamic, and often means learning a special-purpose language. Its Agents SDK takes a code-first approach instead, and OpenAI is shutting its visual Agent Builder canvas on 30 November 2026.

Where agent graphs go wrong

  • Graph explosion

    Every exception becomes a new node and edge until the graph is harder to read than the code it replaced.

  • Model routing in disguise

    A conditional edge that asks a model where to go next brings back the variability the graph was meant to remove.

  • Repeated side effects

    A resumed node restarts from its beginning, so nodes that send messages or write data must be safe to run twice.

  • Hitting the recursion limit

    Loops between nodes that never meet their exit condition stop with an error rather than an answer.

How Motiontic's engineers apply it

Motiontic's engineers use a graph where a process has known stages, approvals and audit needs, such as claims or onboarding flows, and keep model-led loops for the open-ended parts inside a node. Each node is tested on its own, and side-effecting nodes are written to be safe on retry.

An agent graph compared with a code-first agent loop

An agent graph compared with a code-first agent loop
Agent graphCode-first agent loop
How paths are definedDeclared nodes and edgesOrdinary code and the model's tool choices
VisibilityPaths can be drawn and auditedPaths emerge at run time
Pause and resumeBuilt in through checkpointsBuilt by hand or by a runtime
Handles new situationsOnly along declared edgesMore flexibly
Main riskSprawling graphs as exceptions pile upSkipped steps and loops as context grows

Common questions

What is a graph in LangGraph?

A set of nodes, which are functions, joined by edges that decide what runs next, all reading and updating a shared state. It is compiled before use and can be checkpointed so runs pause and resume.

Are agent graphs the same as agentic workflows?

Closely related. An agentic workflow fixes the path in code with model calls at some steps, and a graph is a common way to write one down. Google's ADK 2.0 calls its hybrid of code and model nodes an agentic workflow.

When should an agent be built as a graph?

When the stages are known, must happen in order, need approvals or must be audited. When the next step genuinely depends on judgement over messy input, a model-led loop inside one node usually works better.

Running agents that have to hold up?

Describe the agent, the systems it touches and what it must never get wrong. The first call is with a lab engineer, who will say plainly whether it is ready for production, and whether Motiontic is the right team.