Skip to main content

Quick Overview

This video is a technical software development tutorial presented by Annie Wang, a Software Engineer at Google Cloud. Following up on previous discussions about loop engineering, the video introduces graph engineering concepts and demonstrates how to build deterministic and agentic workflows using Google's Agent Development Kit 2.0 (ADK 2.0).

Key Points

  • 1.Relying on a single large prompt to fetch data and reason in one model call causes hallucinations because ungrounded models lack deterministic API and course data.
  • 2.Graph engineering organizes complex systems by separating predictable operations into deterministic Python functions while reserving large language model calls for reasoning tasks.
  • 3.In Google's Agent Development Kit 2.0 (ADK 2.0), functions and agent nodes operate as peers within the same orchestration graph and wiring structure.
  • 4.Key structural patterns in graph engineering include fan-out for parallel execution, join nodes for aggregating parallel branch outputs without custom aggregator agents, and routing for selecting execution paths.
  • 5.Deterministic routers using code logic are faster, cheaper, and more reliable than LLM routers whenever branching decisions are based on structured data and closed sets of options.
  • 6.Developers should use static graph workflows when a process structure is known beforehand, dynamic workflows when graph shape depends on runtime inputs, and autonomous agents when workflows cannot be predefined.

Summary

The presentation opens by addressing why single-prompt AI implementations fail and how graph engineering provides the necessary architectural fix. Using the scenario of a marathon runner requesting a race strategy, the video examines an initial single-agent approach driven by one large prompt. Although the model outputs detailed numbers regarding start conditions, elevation grades, and pacing zones with high confidence, every metric is completely hallucinated because the model has no connection to weather APIs or course databases. When every step is crammed into one model call, data cannot be fetched, tested, or trusted. Fixing this requires architectural structure rather than refined prompts.

Graph engineering represents the next evolutionary layer beyond prompt engineering, context engineering, and loop engineering. It structures workflows into nodes representing units of work and edges representing the wiring between them. Using Google's Agent Development Kit 2.0 (ADK 2.0), the presenter demonstrates a minimal two-node graph. The first node is a plain Python function that fetches weather conditions without incurring LLM token costs, while the second node is an agent that consumes those conditions to generate strategy advice in a single model call. Within ADK 2.0, functions and LLM agents operate as architectural peers using identical wiring conventions, embodying the principle that predictable work belongs in deterministic functions while reasoning belongs in models.

The workflow is then expanded to handle multiple independent data streams, specifically race weather, course elevation profiles, and runner fitness logs. Because these inputs do not depend on each other, the graph executes them concurrently through a fan-out pattern. For scenarios where the exact number of parallel tasks is unknown ahead of time, ADK 2.0 supports dynamic fan-out generated at runtime. Downstream from the parallel fetchers, a join node acts as a system synthesizer, waiting for all branches to complete before assembling their outputs into a single dictionary keyed by node name, eliminating the need to write custom aggregator agents.

To tailor advice based on race conditions, the architecture introduces a router pattern to choose among three specialist agents configured for hot, normal, or cold weather. The video contrasts two routing approaches: an LLM router, which uses model calls to classify inputs at the expense of extra tokens and non-deterministic variability, and a deterministic code router, which routes via standard conditional statements. For open-ended natural language requests lacking clear signals, an LLM router is appropriate, but for structured data over closed sets, deterministic routers are cheaper and more reliable. In the complete race strategy graph, three data fetches, a join node, a deterministic router, and a single strategy agent execute with only one LLM call.

The presentation concludes with a decision framework for selecting system architectures. If a workflow's structure can be determined prior to receiving user input, developers should implement a static graph workflow. If the workflow structure depends on runtime inputs, such as in deep research tasks, developers should deploy dynamic workflows using ADK 2.0. Fully autonomous agents should be reserved strictly for scenarios where no structured workflow can be defined in advance.

The Failure of Single-Prompt Agent Workflows

Attempting to handle complex end-to-end tasks like marathon race strategy generation through a single large prompt results in confident hallucinations. When data fetching, validation, and strategy creation occur in one model call without real API access or grounded course data, all resulting numbers are invented. Better prompt wording cannot fix this issue because the system lacks structural separation between data retrieval and reasoning.

Building Minimal Peer-Node Graphs with ADK 2.0

Graph engineering solves execution reliability by treating deterministic Python functions and AI agent nodes as peer components within a shared graph structure in Google's Agent Development Kit 2.0. In a minimal two-node implementation, a standard Python function fetches real race-day conditions at zero LLM cost, and an agent node receives that data to perform reasoning in a single model call.

Parallel Execution with Fan-Out and Join Nodes

When tasks such as fetching weather, analyzing elevation profiles, and assessing runner fitness are independent, they can run simultaneously using a fan-out pattern. ADK 2.0 also supports dynamic fan-out at runtime for indeterminate numbers of tasks. A built-in join node synchronizes these branches, waits for the slowest process, and bundles the outputs into a keyed dictionary without requiring a custom aggregator agent.

Deterministic versus LLM Routers

Routing directs workflow execution toward specialized strategy agents based on gathered context. While LLM routers are necessary for open-ended, free-text classifications, deterministic code routers based on conditional statements are preferred for closed sets of conditions because they eliminate extra token costs and prevent non-deterministic misclassifications.

Determining When to Use Graph Engineering

Choosing the appropriate architecture depends on whether the workflow can be drawn before input arrives. Pre-definable processes should use standard graph workflows, while variable investigation tasks like deep research should use runtime dynamic workflows. Autonomous agents remain reserved for tasks where no predetermined path can be constructed.

The Bottom Line

The video establishes that graph engineering using ADK 2.0 prevents hallucinations and reduces token costs by combining deterministic code execution with targeted LLM reasoning. It outlines practical design patterns including parallel fan-outs, join nodes, and deterministic routing, while providing a clear decision matrix for choosing between static graphs, dynamic workflows, and autonomous agents. The presentation leaves deeper production deployment nuances and specific API integrations for viewers to explore within their own implementations.

FAQ

What is graph engineering and what are graph engineering workflows in AI application development?

Graph engineering is an architectural approach that structures AI applications into workflows composed of nodes and connecting edges. Nodes can be deterministic code functions or LLM agents, allowing predictable tasks to run via standard code while isolating generative model calls strictly to reasoning steps.

Why does a single prompt agent fail when generating marathon race day strategies?

A single prompt agent fails because it lacks direct connections to real data sources such as weather APIs or course databases. Because all execution steps occur within a single model call, the language model hallucinates specific metrics with false confidence rather than fetching real data.

How does Google's Agent Development Kit 2.0 treat Python functions and LLM agent nodes?

Google's Agent Development Kit 2.0 treats deterministic Python functions and LLM agents as architectural peers. Both types of nodes use the same wiring, interfaces, and graph orchestration lists.

What is the function of a join node in an ADK 2.0 graph workflow?

A join node acts as a synthesizer that waits for all incoming parallel fan-out branches to finish, gates on the slowest branch, and bundles all output data into a single dictionary keyed by node name without requiring a separate aggregator agent.

When should a developer choose a deterministic router over an LLM router?

A developer should choose a deterministic router when routing decisions operate on a closed set of options and the deciding signals exist within structured data. A deterministic router executes using standard conditional code, eliminating token costs and preventing non-deterministic classification errors.

How should developers determine whether to use a static graph workflow or a dynamic workflow?

Developers should use a static graph workflow if the execution steps can be drawn before user input arrives. If the structure of the workflow depends on the runtime input itself, such as in deep research tasks, a dynamic workflow generated at runtime should be used instead.

Worth watching for

Software engineers and AI developers looking to build robust, cost-effective agentic architectures and workflows using Google's Agent Development Kit 2.0.

  • agent-development-kit
  • graph-engineering
  • ai-agents
  • adk-2-0
  • workflow-orchestration