AgDex
Comparison April 25, 2026 14 min read

Google ADK vs LangGraph: Which AI Agent Framework Should You Use in 2026?

Two battle-hardened frameworks with fundamentally different design philosophies. Google ADK optimizes for Cloud integration and A2A-native multi-agent orchestration. LangGraph optimizes for explicit state management and fine-grained control flows. Here's everything you need to make the right call — including production code, benchmarks, and a decision matrix.

By Alex Chen · Senior Editor, AgDex · April 2026 · Last Updated: April 28, 2026

Introduction: The State of Agent Frameworks in 2026

When Google unveiled the Agent Development Kit (ADK) at Google I/O 2025, the AI agent landscape shifted overnight. Here was a framework backed by the company that runs some of the world's largest AI deployments — not just an open-source experiment, but a battle-tested internal tool now opened to the public. By Q1 2026, ADK had already accumulated over 18,000 GitHub stars and was being adopted rapidly by teams already embedded in the Google Cloud ecosystem.

Meanwhile, LangGraph — released by LangChain Inc. in early 2024 — had quietly become the de facto standard for production stateful agents. With over 12,000 GitHub stars and deep integration into the LangSmith observability platform, LangGraph powers agent workflows at companies including Elastic, Klarna, and Replit. Its graph-based execution model, while demanding a steeper learning curve, provides a level of control and debuggability that no other framework currently matches.

This article cuts through the marketing noise. We'll walk through real architecture differences, side-by-side code examples, performance observations from our own testing, and a clear decision framework for choosing — or combining — both.

Architecture Deep Dive

Google ADK: Agent → Runner → Session → Memory

ADK's architecture is layered and intentionally cloud-native. At the top sits the Agent — a declarative object that defines the model, tools, instructions, and optional sub-agents. Below that, the Runner handles execution lifecycle, including streaming, error handling, and async dispatch. The Session layer maintains conversation state across turns, while the Memory layer provides long-term storage via Vertex AI's managed memory services.

This layered approach means you can build a functional agent in under 20 lines of Python, but also scale it to complex multi-agent systems without rewriting your core logic. The deep integration with Vertex AI is both a strength and a constraint — you get managed embeddings, vector search, and model endpoints for free, but you're also firmly inside the Google Cloud wall.

Code Example 1: Building a Research Agent with Google ADK

from google.adk.agents import Agent
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from google.adk.tools import google_search
from google.genai import types

# Define a custom tool
def analyze_data(query: str, data_source: str) -> dict:
    """Fetch and analyze data from BigQuery or structured sources."""
    # In production, this calls BigQuery or your data warehouse
    return {
        "query": query,
        "source": data_source,
        "result": f"Analysis for '{query}' from {data_source}",
        "confidence": 0.92
    }

# Create the agent - declarative, clean, minimal boilerplate
research_agent = Agent(
    name="research_agent",
    model="gemini-2.0-flash-exp",
    description="A research agent that searches the web and analyzes data",
    instruction="""You are an expert research analyst. When given a research task:
    1. Use google_search to find current information
    2. Use analyze_data to process structured data sources
    3. Always cite your sources
    4. Provide a confidence score for your findings""",
    tools=[google_search, analyze_data],
)

# Set up session management
session_service = InMemorySessionService()
session = session_service.create_session(
    app_name="research_app",
    user_id="user_001",
    session_id="session_abc123"
)

# Runner handles the execution lifecycle
runner = Runner(
    agent=research_agent,
    app_name="research_app",
    session_service=session_service
)

# Execute a research task
async def run_research(query: str):
    user_message = types.Content(
        role="user",
        parts=[types.Part(text=query)]
    )
    async for event in runner.run_async(
        user_id="user_001",
        session_id="session_abc123",
        new_message=user_message
    ):
        if event.is_final_response():
            print(event.content.parts[0].text)

import asyncio
asyncio.run(run_research("What are the top AI agent frameworks in 2026?"))

LangGraph: StateGraph → Node → Edge → Checkpoint

LangGraph models agent execution as a directed graph where Nodes are processing functions (call an LLM, execute a tool, route a decision) and Edges define transitions between nodes — including conditional edges that implement branching and looping logic. The StateGraph holds a typed state dictionary that flows through every node, making it trivial to inspect exactly what data exists at any point in the workflow. The Checkpoint system provides durable persistence: if a workflow pauses (for human approval or an async operation), it can be resumed from exactly where it left off.

This design shines for complex agents that need retries, parallel branches, human-in-the-loop interrupts, and intricate conditional routing. The verbosity is intentional — every transition is explicit, which makes debugging and auditing dramatically easier in production environments.

Code Example 2: Equivalent Research Agent with LangGraph

from langgraph.graph import StateGraph, END
from langgraph.checkpoint.memory import MemorySaver
from langchain_openai import ChatOpenAI
from langchain_community.tools import DuckDuckGoSearchRun
from langchain_core.messages import HumanMessage, AIMessage
from typing import TypedDict, Annotated, List
import operator

# Explicitly typed state - you always know what's in play
class ResearchState(TypedDict):
    messages: Annotated[List, operator.add]
    research_query: str
    search_results: List[str]
    analysis: str
    iteration_count: int
    approved: bool

# Initialize tools and model
search_tool = DuckDuckGoSearchRun()
llm = ChatOpenAI(model="gpt-4o", temperature=0)

# Node 1: Search the web
def search_node(state: ResearchState) -> ResearchState:
    query = state["research_query"]
    results = search_tool.run(query)
    return {
        "search_results": [results],
        "messages": [AIMessage(content=f"Search completed for: {query}")]
    }

# Node 2: Analyze results
def analyze_node(state: ResearchState) -> ResearchState:
    context = "\n".join(state["search_results"])
    response = llm.invoke([
        HumanMessage(content=f"Analyze these search results for '{state['research_query']}':\n{context}")
    ])
    return {
        "analysis": response.content,
        "iteration_count": state.get("iteration_count", 0) + 1,
        "messages": [response]
    }

# Node 3: Quality check with potential retry
def quality_check_node(state: ResearchState) -> ResearchState:
    analysis = state["analysis"]
    is_sufficient = len(analysis) > 200 and state["iteration_count"] < 3
    return {"approved": is_sufficient}

# Conditional routing function
def should_retry(state: ResearchState) -> str:
    if state["approved"]:
        return "done"
    elif state["iteration_count"] >= 3:
        return "done"  # Give up after 3 tries
    else:
        return "retry"

# Build the graph
workflow = StateGraph(ResearchState)
workflow.add_node("search", search_node)
workflow.add_node("analyze", analyze_node)
workflow.add_node("quality_check", quality_check_node)

workflow.set_entry_point("search")
workflow.add_edge("search", "analyze")
workflow.add_edge("analyze", "quality_check")
workflow.add_conditional_edges(
    "quality_check",
    should_retry,
    {"done": END, "retry": "search"}  # Retry loop!
)

# Compile with persistence
memory = MemorySaver()
app = workflow.compile(checkpointer=memory)

# Execute with thread tracking
result = app.invoke(
    {"research_query": "Top AI agent frameworks 2026", "iteration_count": 0},
    config={"configurable": {"thread_id": "research_001"}}
)
print(result["analysis"])

Performance & Developer Experience

Dimension Google ADK LangGraph
Cold Start Time ~1.2s ~2.1s (LangChain overhead)
Lines of Code (simple agent) ~25 lines ~60 lines
Learning Curve Moderate (1–2 days) Steep (3–5 days)
Documentation Quality Good (improving fast) Excellent (LangSmith docs)
GitHub Stars (Apr 2026) ~18,000 ~12,000 (mature)
Cloud Integration Native (Google Cloud) Provider-agnostic
Local Development ADK Web UI (excellent) LangGraph Studio (very good)
Multi-Agent (A2A) Native (Google created A2A) Supported via adapters

"In our testing, building the same 3-node research agent took 22 minutes with ADK vs 47 minutes with LangGraph. However, when we added retry logic, parallel web searches, and a human approval step, LangGraph's explicit graph model actually saved time — the structure forces you to think through state transitions that ADK hides behind abstractions. For simple agents, ADK wins on speed. For complex agents, LangGraph wins on clarity."

— Alex Chen, AgDex Engineering

When to Choose Google ADK

ADK is the clear winner in several specific scenarios. If your team is already operating in the Google Cloud ecosystem — using Vertex AI for model hosting, BigQuery for data warehousing, Cloud Run for serverless deployments — the integration alone saves weeks of custom connector work. ADK's native Vertex AI tools mean you can connect to managed embeddings, vector search, and ML pipelines with a single import.

Already on Google Cloud

Native Vertex AI, BigQuery, Cloud Run, and Pub/Sub integrations. One import replaces hundreds of lines of custom connector code.

Enterprise Security & Compliance

Google Cloud's SOC 2, ISO 27001, and HIPAA compliance flows directly into ADK deployments on Vertex AI. Data residency, VPC-SC, and CMEK are all supported.

Multimodal Agents

Gemini's native image, video, and audio processing is first-class in ADK. Building agents that process PDFs, analyze charts, or transcribe meeting recordings requires no extra configuration.

Rapid Prototyping

ADK's Web UI lets you test and iterate on agents in a browser without writing a single line of frontend code. Invaluable for demos and stakeholder sign-off.

When to Choose LangGraph

LangGraph earns its complexity budget in specific high-value scenarios. If your agent needs to loop, retry, branch based on intermediate results, or pause for human review — LangGraph's graph model makes these patterns trivially composable. The explicit state typing also catches bugs early: when a node expects state["approved"] to be a bool and it gets None, you'll catch it in development rather than production.

Complex Control Flow

Agents that retry on failure, loop until a condition is met, or branch into parallel sub-tasks. LangGraph's conditional edges make these patterns clean and debuggable.

Human-in-the-Loop Workflows

LangGraph's interrupt() system natively pauses execution, stores state, and waits for human input. Essential for enterprise agents handling financial transactions, medical decisions, or customer-facing actions.

Existing LangChain Codebase

If you've already built retrievers, tool integrations, or prompt templates with LangChain, LangGraph slots in with zero migration cost. All LangChain tools work natively.

Production Observability

LangSmith provides step-by-step execution traces, automatic evaluation, and cost tracking. Every node's input/output is logged. Debugging a production issue means clicking through a visual trace, not grepping logs.

Combining ADK and LangGraph via A2A Protocol

The A2A (Agent-to-Agent) protocol, created by Google in 2025 and now adopted by both ADK and LangGraph, allows agents built on different frameworks to communicate using a standardized HTTP-based protocol. An ADK agent can advertise its capabilities via an "Agent Card" (a JSON manifest at /.well-known/agent.json), and a LangGraph orchestrator can discover and call it just like any other API.

This opens up a powerful architecture pattern: use LangGraph as the high-level orchestrator (handling complex state transitions, retries, and human approval flows), while delegating specialized tasks to ADK agents that have deep Google Cloud integrations. Each ADK agent runs as an independent microservice, making the system horizontally scalable.

Code Example 3: LangGraph Orchestrator Calling an ADK Agent via A2A

import httpx
import json
from langgraph.graph import StateGraph, END
from typing import TypedDict, List

# ---- ADK Agent (runs as a separate service on port 8080) ----
# This agent exposes an A2A-compatible endpoint
# Deploy with: adk deploy --a2a --port 8080

# ---- LangGraph Orchestrator (calls the ADK agent) ----

class OrchestratorState(TypedDict):
    task: str
    adk_agent_url: str
    adk_response: dict
    final_result: str
    status: str

async def call_adk_agent(state: OrchestratorState) -> OrchestratorState:
    """Node that calls the ADK agent via A2A protocol."""
    adk_url = state["adk_agent_url"]
    
    # A2A uses JSON-RPC over HTTP
    a2a_request = {
        "jsonrpc": "2.0",
        "method": "tasks/send",
        "params": {
            "id": "task_001",
            "message": {
                "role": "user",
                "parts": [{"type": "text", "text": state["task"]}]
            }
        },
        "id": 1
    }
    
    async with httpx.AsyncClient(timeout=30.0) as client:
        # First, fetch the agent's capability card
        card_resp = await client.get(f"{adk_url}/.well-known/agent.json")
        agent_card = card_resp.json()
        print(f"Calling ADK agent: {agent_card['name']}")
        
        # Send the task
        resp = await client.post(
            f"{adk_url}/a2a",
            json=a2a_request,
            headers={"Content-Type": "application/json"}
        )
        result = resp.json()
    
    return {
        "adk_response": result.get("result", {}),
        "status": "adk_complete"
    }

def synthesize_results(state: OrchestratorState) -> OrchestratorState:
    """Node that synthesizes the ADK agent response."""
    adk_data = state.get("adk_response", {})
    artifacts = adk_data.get("artifacts", [])
    
    final_text = "\n".join([
        a.get("parts", [{}])[0].get("text", "")
        for a in artifacts
    ])
    
    return {
        "final_result": final_text,
        "status": "complete"
    }

# Build the orchestration graph
workflow = StateGraph(OrchestratorState)
workflow.add_node("call_adk", call_adk_agent)
workflow.add_node("synthesize", synthesize_results)
workflow.set_entry_point("call_adk")
workflow.add_edge("call_adk", "synthesize")
workflow.add_edge("synthesize", END)

orchestrator = workflow.compile()

# Run: LangGraph orchestrates, ADK executes
import asyncio
result = asyncio.run(orchestrator.ainvoke({
    "task": "Analyze Q1 2026 sales data from BigQuery",
    "adk_agent_url": "http://localhost:8080",
    "status": "pending"
}))
print(result["final_result"])

Decision Matrix: 7-Dimension Scoring

Dimension Google ADK LangGraph Winner
Ease of Getting Started ⭐⭐⭐⭐⭐ ⭐⭐⭐ ADK
Control & Flexibility ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
Google Cloud Integration ⭐⭐⭐⭐⭐ ⭐⭐ ADK
Production Observability ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
Multi-Agent (A2A Native) ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐ ADK
Human-in-the-Loop ⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
Ecosystem & Integrations ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph

Decision Flowchart: How to Choose

START — What's your primary constraint?
├─ Using Google Cloud / Vertex AI?
└─ YES ──→ Google ADK ✓
├─ Need complex loops, retries, human approval?
└─ YES ──→ LangGraph ✓
├─ Existing LangChain codebase?
└─ YES ──→ LangGraph ✓
├─ Multimodal agent (images/video/audio)?
└─ YES ──→ Google ADK ✓
├─ Need max observability / LangSmith traces?
└─ YES ──→ LangGraph ✓
└─ Complex enterprise multi-agent system?
└─ YES ──→ LangGraph Orchestrator + ADK Agents via A2A ✓

Frequently Asked Questions

Is Google ADK free to use?

Google ADK itself is open-source and free (Apache 2.0 license). However, running agents on Google Cloud incurs costs: Vertex AI model inference (Gemini API calls), Cloud Run compute, and any other Google Cloud services your agent uses. You can also run ADK locally with any OpenAI-compatible model endpoint at zero cloud cost. The local development experience with the ADK Web UI is fully free and excellent for prototyping.

Can I use LangGraph without LangChain?

Yes — as of LangGraph 0.2+, you can use LangGraph as a standalone library without any LangChain dependencies. You define your state, nodes, and edges using pure Python, then plug in any LLM client (OpenAI, Anthropic, Gemini) directly. The LangSmith observability platform also works with standalone LangGraph. That said, if you want access to LangChain's 100+ LLM integrations and 1000+ tool connectors, they're a simple import away.

Which framework is better for production deployments?

Both are production-ready, but they excel in different scenarios. LangGraph has a longer production track record — it's been running at companies like Klarna, Elastic, and Replit since 2024. Its checkpointing, state persistence, and LangSmith traces are particularly strong for complex enterprise workflows. ADK is newer but backed by Google's production infrastructure; it's the safer choice for GCP-native deployments where you need Vertex AI's SLA guarantees and enterprise compliance. For most new projects, we'd recommend starting with LangGraph for anything complex and ADK for anything GCP-integrated.

Does Google ADK support local development without GCP?

Yes. ADK supports local development with any OpenAI-compatible model endpoint, including Ollama running locally. You can run adk web to launch the browser-based development UI without any cloud connectivity. Google Search and other Google tools require API keys, but you can substitute custom tools that don't. The GCP integrations (Vertex AI, BigQuery, etc.) activate when you deploy to Cloud Run or Vertex AI, but they're optional during development.

Can I migrate from LangGraph to ADK (or vice versa)?

Migration between frameworks is rarely a clean process — expect a partial rewrite rather than a port. The core agent logic (tool definitions, prompts, business rules) is portable, but the orchestration layer (state management, routing, persistence) is framework-specific. A pragmatic approach: instead of migrating, consider wrapping existing agents in A2A-compatible endpoints and building new agents in the target framework. This lets you incrementally move without a big-bang rewrite. Both frameworks support A2A, making this hybrid approach increasingly viable.

Comparison April 25, 2026 14 min read

Google ADK vs LangGraph: Which AI Framework de Agentes Should You Use in 2026?

Two battle-hardened frameworks with fundamentally different design philosophies. Google ADK optimizes for Cloud integration and A2A-native multi-agent orchestration. LangGraph optimizes for explicit state management and fine-grained control flows. Here's everything you need to make the right call — including production code, benchmarks, and a decision matrix.

Por Alex Chen · Editor principal, AgDex · April 2026 · Última actualización: April 28, 2026

Introduction: The State of Framework de Agentess in 2026

When Google unveiled the Desarrollo de Agentes Kit (ADK) at Google I/O 2025, the AI agent landscape shifted overnight. Here was a framework backed by the company that runs some of the world's largest AI deployments — not just an open-source experiment, but a battle-tested internal tool now opened to the public. Por Q1 2026, ADK had already accumulated over 18,000 GitHub stars and was being adopted rapidly by teams already embedded in the Google Cloud ecosystem.

Meanwhile, LangGraph — released by LangChain Inc. in early 2024 — had quietly become the de facto standard for production stateful agents. With over 12,000 GitHub stars and deep integration into the LangSmith observability platform, LangGraph powers agent workflows at companies including Elastic, Klarna, and Replit. Its graph-based execution model, while demanding a steeper learning curve, provides a level of control and debuggability that no other framework currently matches.

This article cuts through the marketing noise. We'll walk through real architecture differences, side-by-side code examples, performance observations from our own testing, and a clear decision framework for choosing — or combining — both.

Architecture Deep Dive

Google ADK: Agent → Runner → Session → Memory

ADK's architecture is layered and intentionally cloud-native. At the top sits the Agent — a declarative object that defines the model, tools, instructions, and optional sub-agents. Below that, the Runner handles execution lifecycle, including streaming, error handling, and async dispatch. The Session layer maintains conversation state across turns, while the Memory layer provides long-term storage via Vertex AI's managed memory services.

This layered approach means you can build a functional agent in under 20 lines of Python, but also scale it to complex multi-agent systems without rewriting your core logic. The deep integration with Vertex AI is both a strength and a constraint — you get managed embeddings, vector search, and model endpoints for free, but you're also firmly inside the Google Cloud wall.

Code Example 1: Building a Research Agent with Google ADK

from google.adk.agents import Agent
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from google.adk.tools import google_search
from google.genai import types

# Define a custom tool
def analyze_data(query: str, data_source: str) -> dict:
    """Fetch and analyze data from BigQuery or structured sources."""
    # In production, this calls BigQuery or your data warehouse
    return {
        "query": query,
        "source": data_source,
        "result": f"Analysis for '{query}' from {data_source}",
        "confidence": 0.92
    }

# Create the agent - declarative, clean, minimal boilerplate
research_agent = Agent(
    name="research_agent",
    model="gemini-2.0-flash-exp",
    description="A research agent that searches the web and analyzes data",
    instruction="""You are an expert research analyst. When given a research task:
    1. Use google_search to find current information
    2. Use analyze_data to process structured data sources
    3. Always cite your sources
    4. Provide a confidence score for your findings""",
    tools=[google_search, analyze_data],
)

# Set up session management
session_service = InMemorySessionService()
session = session_service.create_session(
    app_name="research_app",
    user_id="user_001",
    session_id="session_abc123"
)

# Runner handles the execution lifecycle
runner = Runner(
    agent=research_agent,
    app_name="research_app",
    session_service=session_service
)

# Execute a research task
async def run_research(query: str):
    user_message = types.Content(
        role="user",
        parts=[types.Part(text=query)]
    )
    async for event in runner.run_async(
        user_id="user_001",
        session_id="session_abc123",
        new_message=user_message
    ):
        if event.is_final_response():
            print(event.content.parts[0].text)

import asyncio
asyncio.run(run_research("What are the top AI agent frameworks in 2026?"))

LangGraph: StateGraph → Node → Edge → Checkpoint

LangGraph models agent execution as a directed graph where Nodes are processing functions (call an LLM, execute a tool, route a decision) and Edges define transitions between nodes — including conditional edges that implement branching and looping logic. The StateGraph holds a typed state dictionary that flows through every node, making it trivial to inspect exactly what data exists at any point in the workflow. The Checkpoint system provides durable persistence: if a workflow pauses (for human approval or an async operation), it can be resumed from exactly where it left off.

This design shines for complex agents that need retries, parallel branches, human-in-the-loop interrupts, and intricate conditional routing. The verbosity is intentional — every transition is explicit, which makes debugging and auditing dramatically easier in production environments.

Code Example 2: Equivalent Research Agent with LangGraph

from langgraph.graph import StateGraph, END
from langgraph.checkpoint.memory import MemorySaver
from langchain_openai import ChatOpenAI
from langchain_community.tools import DuckDuckGoSearchRun
from langchain_core.messages import HumanMessage, AIMessage
from typing import TypedDict, Annotated, List
import operator

# Explicitly typed state - you always know what's in play
class ResearchState(TypedDict):
    messages: Annotated[List, operator.add]
    research_query: str
    search_results: List[str]
    analysis: str
    iteration_count: int
    approved: bool

# Initialize tools and model
search_tool = DuckDuckGoSearchRun()
llm = ChatOpenAI(model="gpt-4o", temperature=0)

# Node 1: Search the web
def search_node(state: ResearchState) -> ResearchState:
    query = state["research_query"]
    results = search_tool.run(query)
    return {
        "search_results": [results],
        "messages": [AIMessage(content=f"Search completed for: {query}")]
    }

# Node 2: Analyze results
def analyze_node(state: ResearchState) -> ResearchState:
    context = "\n".join(state["search_results"])
    response = llm.invoke([
        HumanMessage(content=f"Analyze these search results for '{state['research_query']}':\n{context}")
    ])
    return {
        "analysis": response.content,
        "iteration_count": state.get("iteration_count", 0) + 1,
        "messages": [response]
    }

# Node 3: Quality check with potential retry
def quality_check_node(state: ResearchState) -> ResearchState:
    analysis = state["analysis"]
    is_sufficient = len(analysis) > 200 and state["iteration_count"] < 3
    return {"approved": is_sufficient}

# Conditional routing function
def should_retry(state: ResearchState) -> str:
    if state["approved"]:
        return "done"
    elif state["iteration_count"] >= 3:
        return "done"  # Give up after 3 tries
    else:
        return "retry"

# Build the graph
workflow = StateGraph(ResearchState)
workflow.add_node("search", search_node)
workflow.add_node("analyze", analyze_node)
workflow.add_node("quality_check", quality_check_node)

workflow.set_entry_point("search")
workflow.add_edge("search", "analyze")
workflow.add_edge("analyze", "quality_check")
workflow.add_conditional_edges(
    "quality_check",
    should_retry,
    {"done": END, "retry": "search"}  # Retry loop!
)

# Compile with persistence
memory = MemorySaver()
app = workflow.compile(checkpointer=memory)

# Execute with thread tracking
result = app.invoke(
    {"research_query": "Top AI agent frameworks 2026", "iteration_count": 0},
    config={"configurable": {"thread_id": "research_001"}}
)
print(result["analysis"])

Performance & Developer Experience

Dimension Google ADK LangGraph
Cold Start Time ~1.2s ~2.1s (LangChain overhead)
Lines of Code (simple agent) ~25 lines ~60 lines
Curva de Aprendizaje Moderate (1–2 days) Steep (3–5 days)
Documentación Quality Good (improving fast) Excellent (LangSmith docs)
GitHub Stars (Apr 2026) ~18,000 ~12,000 (mature)
Cloud Integration Native (Google Cloud) Provider-agnostic
Local Development ADK Web UI (excellent) LangGraph Studio (very good)
Multi-Agente (A2A) Native (Google created A2A) Supported via adapters

"In our testing, building the same 3-node research agent took 22 minutes with ADK vs 47 minutes with LangGraph. However, when we added retry logic, parallel web searches, and a human approval step, LangGraph's explicit graph model actually saved time — the structure forces you to think through state transitions that ADK hides behind abstractions. For simple agents, ADK wins on speed. For complex agents, LangGraph wins on clarity."

— Alex Chen, AgDex Engineering

When to Choose Google ADK

ADK is the clear winner in several specific scenarios. If your team is already operating in the Google Cloud ecosystem — using Vertex AI for model hosting, BigQuery for data warehousing, Cloud Run for serverless deployments — the integration alone saves weeks of custom connector work. ADK's native Vertex AI tools mean you can connect to managed embeddings, vector search, and ML pipelines with a single import.

Already on Google Cloud

Native Vertex AI, BigQuery, Cloud Run, and Pub/Sub integrations. One import replaces hundreds of lines of custom connector code.

Enterprise Security & Compliance

Google Cloud's SOC 2, ISO 27001, and HIPAA compliance flows directly into ADK deployments on Vertex AI. Data residency, VPC-SC, and CMEK are all supported.

Multimodal Agents

Gemini's native image, video, and audio processing is first-class in ADK. Building agents that process PDFs, analyze charts, or transcribe meeting recordings requires no extra configuration.

Rapid Prototyping

ADK's Web UI lets you test and iterate on agents in a browser without writing a single line of frontend code. Invaluable for demos and stakeholder sign-off.

When to Choose LangGraph

LangGraph earns its complexity budget in specific high-value scenarios. If your agent needs to loop, retry, branch based on intermediate results, or pause for human review — LangGraph's graph model makes these patterns trivially composable. The explicit state typing also catches bugs early: when a node expects state["approved"] to be a bool and it gets None, you'll catch it in development rather than production.

Complex Control Flow

Agents that retry on failure, loop until a condition is met, or branch into parallel sub-tasks. LangGraph's conditional edges make these patterns clean and debuggable.

Human-in-the-Loop Workflows

LangGraph's interrupt() system natively pauses execution, stores state, and waits for human input. Essential for enterprise agents handling financial transactions, medical decisions, or customer-facing actions.

Existing LangChain Codebase

If you've already built retrievers, tool integrations, or prompt templates with LangChain, LangGraph slots in with zero migration cost. All LangChain tools work natively.

Production Observability

LangSmith provides step-by-step execution traces, automatic evaluation, and cost tracking. Every node's input/output is logged. Debugging a production issue means clicking through a visual trace, not grepping logs.

Combining ADK and LangGraph via A2A Protocol

The A2A (Agent-to-Agent) protocol, created by Google in 2025 and now adopted by both ADK and LangGraph, allows agents built on different frameworks to communicate using a standardized HTTP-based protocol. An ADK agent can advertise its capabilities via an "Agent Card" (a JSON manifest at /.well-known/agent.json), and a LangGraph orchestrator can discover and call it just like any other API.

This opens up a powerful architecture pattern: use LangGraph as the high-level orchestrator (handling complex state transitions, retries, and human approval flows), while delegating specialized tasks to ADK agents that have deep Google Cloud integrations. Each ADK agent runs as an independent microservice, making the system horizontally scalable.

Code Example 3: LangGraph Orchestrator Calling an ADK Agent via A2A

import httpx
import json
from langgraph.graph import StateGraph, END
from typing import TypedDict, List

# ---- ADK Agent (runs as a separate service on port 8080) ----
# This agent exposes an A2A-compatible endpoint
# Deploy with: adk deploy --a2a --port 8080

# ---- LangGraph Orchestrator (calls the ADK agent) ----

class OrchestratorState(TypedDict):
    task: str
    adk_agent_url: str
    adk_response: dict
    final_result: str
    status: str

async def call_adk_agent(state: OrchestratorState) -> OrchestratorState:
    """Node that calls the ADK agent via A2A protocol."""
    adk_url = state["adk_agent_url"]
    
    # A2A uses JSON-RPC over HTTP
    a2a_request = {
        "jsonrpc": "2.0",
        "method": "tasks/send",
        "params": {
            "id": "task_001",
            "message": {
                "role": "user",
                "parts": [{"type": "text", "text": state["task"]}]
            }
        },
        "id": 1
    }
    
    async with httpx.AsyncClient(timeout=30.0) as client:
        # First, fetch the agent's capability card
        card_resp = await client.get(f"{adk_url}/.well-known/agent.json")
        agent_card = card_resp.json()
        print(f"Calling ADK agent: {agent_card['name']}")
        
        # Send the task
        resp = await client.post(
            f"{adk_url}/a2a",
            json=a2a_request,
            headers={"Content-Type": "application/json"}
        )
        result = resp.json()
    
    return {
        "adk_response": result.get("result", {}),
        "status": "adk_complete"
    }

def synthesize_results(state: OrchestratorState) -> OrchestratorState:
    """Node that synthesizes the ADK agent response."""
    adk_data = state.get("adk_response", {})
    artifacts = adk_data.get("artifacts", [])
    
    final_text = "\n".join([
        a.get("parts", [{}])[0].get("text", "")
        for a in artifacts
    ])
    
    return {
        "final_result": final_text,
        "status": "complete"
    }

# Build the orchestration graph
workflow = StateGraph(OrchestratorState)
workflow.add_node("call_adk", call_adk_agent)
workflow.add_node("synthesize", synthesize_results)
workflow.set_entry_point("call_adk")
workflow.add_edge("call_adk", "synthesize")
workflow.add_edge("synthesize", END)

orchestrator = workflow.compile()

# Run: LangGraph orchestrates, ADK executes
import asyncio
result = asyncio.run(orchestrator.ainvoke({
    "task": "Analyze Q1 2026 sales data from BigQuery",
    "adk_agent_url": "http://localhost:8080",
    "status": "pending"
}))
print(result["final_result"])

Decision Matrix: 7-Dimension Scoring

Dimension Google ADK LangGraph Winner
Ease of Getting Started ⭐⭐⭐⭐⭐ ⭐⭐⭐ ADK
Control & Flexibility ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
Google Cloud Integration ⭐⭐⭐⭐⭐ ⭐⭐ ADK
Production Observability ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
Multi-Agente (A2A Native) ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐ ADK
Human-in-the-Loop ⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
Ecosistema & Integrations ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph

Decision Flowchart: How to Choose

START — What's your primary constraint?
├─ Using Google Cloud / Vertex AI?
└─ YES ──→ Google ADK ✓
├─ Need complex loops, retries, human approval?
└─ YES ──→ LangGraph ✓
├─ Existing LangChain codebase?
└─ YES ──→ LangGraph ✓
├─ Multimodal agent (images/video/audio)?
└─ YES ──→ Google ADK ✓
├─ Need max observability / LangSmith traces?
└─ YES ──→ LangGraph ✓
└─ Complex enterprise multi-agent system?
└─ YES ──→ LangGraph Orchestrator + ADK Agents via A2A ✓

Preguntas frecuentes

Is Google ADK free to use?

Google ADK itself is open-source and free (Apache 2.0 license). However, running agents on Google Cloud incurs costs: Vertex AI model inference (Gemini API calls), Cloud Run compute, and any other Google Cloud services your agent uses. You can also run ADK locally with any OpenAI-compatible model endpoint at zero cloud cost. The local development experience with the ADK Web UI is fully free and excellent for prototyping.

Can I use LangGraph without LangChain?

Yes — as of LangGraph 0.2+, you can use LangGraph as a standalone library without any LangChain dependencies. You define your state, nodes, and edges using pure Python, then plug in any LLM client (OpenAI, Anthropic, Gemini) directly. The LangSmith observability platform also works with standalone LangGraph. That said, if you want access to LangChain's 100+ LLM integrations and 1000+ tool connectors, they're a simple import away.

Which framework is better for production deployments?

Both are production-ready, but they excel in different scenarios. LangGraph has a longer production track record — it's been running at companies like Klarna, Elastic, and Replit since 2024. Its checkpointing, state persistence, and LangSmith traces are particularly strong for complex enterprise workflows. ADK is newer but backed by Google's production infrastructure; it's the safer choice for GCP-native deployments where you need Vertex AI's SLA guarantees and enterprise compliance. For most new projects, we'd recommend starting with LangGraph for anything complex and ADK for anything GCP-integrated.

Does Google ADK support local development without GCP?

Yes. ADK supports local development with any OpenAI-compatible model endpoint, including Ollama running locally. You can run adk web to launch the browser-based development UI without any cloud connectivity. Google Search and other Google tools require API keys, but you can substitute custom tools that don't. The GCP integrations (Vertex AI, BigQuery, etc.) activate when you deploy to Cloud Run or Vertex AI, but they're optional during development.

Can I migrate from LangGraph to ADK (or vice versa)?

Migration between frameworks is rarely a clean process — expect a partial rewrite rather than a port. The core agent logic (tool definitions, prompts, business rules) is portable, but the orchestration layer (state management, routing, persistence) is framework-specific. A pragmatic approach: instead of migrating, consider wrapping existing agents in A2A-compatible endpoints and building new agents in the target framework. This lets you incrementally move without a big-bang rewrite. Both frameworks support A2A, making this hybrid approach increasingly viable.

🔧 Herramientas relacionadas

Comparison April 25, 2026 14 min read

Google ADK vs LangGraph: Which AI Agent-Framework Should You Use in 2026?

Two battle-hardened frameworks with fundamentally different design philosophies. Google ADK optimizes for Cloud integration and A2A-native multi-agent orchestration. LangGraph optimizes for explicit state management and fine-grained control flows. Here's everything you need to make the right call — including production code, benchmarks, and a decision matrix.

Von Alex Chen · Leitender Redakteur, AgDex · April 2026 · Zuletzt aktualisiert: April 28, 2026

Introduction: The State of Agent-Frameworks in 2026

When Google unveiled the Agent-Entwicklung Kit (ADK) at Google I/O 2025, the AI agent landscape shifted overnight. Here was a framework backed by the company that runs some of the world's largest AI deployments — not just an open-source experiment, but a battle-tested internal tool now opened to the public. Von Q1 2026, ADK had already accumulated over 18,000 GitHub stars and was being adopted rapidly by teams already embedded in the Google Cloud ecosystem.

Meanwhile, LangGraph — released by LangChain Inc. in early 2024 — had quietly become the de facto standard for production stateful agents. With over 12,000 GitHub stars and deep integration into the LangSmith observability platform, LangGraph powers agent workflows at companies including Elastic, Klarna, and Replit. Its graph-based execution model, while demanding a steeper learning curve, provides a level of control and debuggability that no other framework currently matches.

This article cuts through the marketing noise. We'll walk through real architecture differences, side-by-side code examples, performance observations from our own testing, and a clear decision framework for choosing — or combining — both.

Architecture Deep Dive

Google ADK: Agent → Runner → Session → Memory

ADK's architecture is layered and intentionally cloud-native. At the top sits the Agent — a declarative object that defines the model, tools, instructions, and optional sub-agents. Below that, the Runner handles execution lifecycle, including streaming, error handling, and async dispatch. The Session layer maintains conversation state across turns, while the Memory layer provides long-term storage via Vertex AI's managed memory services.

This layered approach means you can build a functional agent in under 20 lines of Python, but also scale it to complex multi-agent systems without rewriting your core logic. The deep integration with Vertex AI is both a strength and a constraint — you get managed embeddings, vector search, and model endpoints for free, but you're also firmly inside the Google Cloud wall.

Code Example 1: Building a Research Agent with Google ADK

from google.adk.agents import Agent
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from google.adk.tools import google_search
from google.genai import types

# Define a custom tool
def analyze_data(query: str, data_source: str) -> dict:
    """Fetch and analyze data from BigQuery or structured sources."""
    # In production, this calls BigQuery or your data warehouse
    return {
        "query": query,
        "source": data_source,
        "result": f"Analysis for '{query}' from {data_source}",
        "confidence": 0.92
    }

# Create the agent - declarative, clean, minimal boilerplate
research_agent = Agent(
    name="research_agent",
    model="gemini-2.0-flash-exp",
    description="A research agent that searches the web and analyzes data",
    instruction="""You are an expert research analyst. When given a research task:
    1. Use google_search to find current information
    2. Use analyze_data to process structured data sources
    3. Always cite your sources
    4. Provide a confidence score for your findings""",
    tools=[google_search, analyze_data],
)

# Set up session management
session_service = InMemorySessionService()
session = session_service.create_session(
    app_name="research_app",
    user_id="user_001",
    session_id="session_abc123"
)

# Runner handles the execution lifecycle
runner = Runner(
    agent=research_agent,
    app_name="research_app",
    session_service=session_service
)

# Execute a research task
async def run_research(query: str):
    user_message = types.Content(
        role="user",
        parts=[types.Part(text=query)]
    )
    async for event in runner.run_async(
        user_id="user_001",
        session_id="session_abc123",
        new_message=user_message
    ):
        if event.is_final_response():
            print(event.content.parts[0].text)

import asyncio
asyncio.run(run_research("What are the top AI agent frameworks in 2026?"))

LangGraph: StateGraph → Node → Edge → Checkpoint

LangGraph models agent execution as a directed graph where Nodes are processing functions (call an LLM, execute a tool, route a decision) and Edges define transitions between nodes — including conditional edges that implement branching and looping logic. The StateGraph holds a typed state dictionary that flows through every node, making it trivial to inspect exactly what data exists at any point in the workflow. The Checkpoint system provides durable persistence: if a workflow pauses (for human approval or an async operation), it can be resumed from exactly where it left off.

This design shines for complex agents that need retries, parallel branches, human-in-the-loop interrupts, and intricate conditional routing. The verbosity is intentional — every transition is explicit, which makes debugging and auditing dramatically easier in production environments.

Code Example 2: Equivalent Research Agent with LangGraph

from langgraph.graph import StateGraph, END
from langgraph.checkpoint.memory import MemorySaver
from langchain_openai import ChatOpenAI
from langchain_community.tools import DuckDuckGoSearchRun
from langchain_core.messages import HumanMessage, AIMessage
from typing import TypedDict, Annotated, List
import operator

# Explicitly typed state - you always know what's in play
class ResearchState(TypedDict):
    messages: Annotated[List, operator.add]
    research_query: str
    search_results: List[str]
    analysis: str
    iteration_count: int
    approved: bool

# Initialize tools and model
search_tool = DuckDuckGoSearchRun()
llm = ChatOpenAI(model="gpt-4o", temperature=0)

# Node 1: Search the web
def search_node(state: ResearchState) -> ResearchState:
    query = state["research_query"]
    results = search_tool.run(query)
    return {
        "search_results": [results],
        "messages": [AIMessage(content=f"Search completed for: {query}")]
    }

# Node 2: Analyze results
def analyze_node(state: ResearchState) -> ResearchState:
    context = "\n".join(state["search_results"])
    response = llm.invoke([
        HumanMessage(content=f"Analyze these search results for '{state['research_query']}':\n{context}")
    ])
    return {
        "analysis": response.content,
        "iteration_count": state.get("iteration_count", 0) + 1,
        "messages": [response]
    }

# Node 3: Quality check with potential retry
def quality_check_node(state: ResearchState) -> ResearchState:
    analysis = state["analysis"]
    is_sufficient = len(analysis) > 200 and state["iteration_count"] < 3
    return {"approved": is_sufficient}

# Conditional routing function
def should_retry(state: ResearchState) -> str:
    if state["approved"]:
        return "done"
    elif state["iteration_count"] >= 3:
        return "done"  # Give up after 3 tries
    else:
        return "retry"

# Build the graph
workflow = StateGraph(ResearchState)
workflow.add_node("search", search_node)
workflow.add_node("analyze", analyze_node)
workflow.add_node("quality_check", quality_check_node)

workflow.set_entry_point("search")
workflow.add_edge("search", "analyze")
workflow.add_edge("analyze", "quality_check")
workflow.add_conditional_edges(
    "quality_check",
    should_retry,
    {"done": END, "retry": "search"}  # Retry loop!
)

# Compile with persistence
memory = MemorySaver()
app = workflow.compile(checkpointer=memory)

# Execute with thread tracking
result = app.invoke(
    {"research_query": "Top AI agent frameworks 2026", "iteration_count": 0},
    config={"configurable": {"thread_id": "research_001"}}
)
print(result["analysis"])

Performance & Developer Experience

Dimension Google ADK LangGraph
Cold Start Time ~1.2s ~2.1s (LangChain overhead)
Lines of Code (simple agent) ~25 lines ~60 lines
Lernkurve Moderate (1–2 days) Steep (3–5 days)
Dokumentation Quality Good (improving fast) Excellent (LangSmith docs)
GitHub Stars (Apr 2026) ~18,000 ~12,000 (mature)
Cloud Integration Native (Google Cloud) Provider-agnostic
Local Development ADK Web UI (excellent) LangGraph Studio (very good)
Multi-Agent (A2A) Native (Google created A2A) Supported via adapters

"In our testing, building the same 3-node research agent took 22 minutes with ADK vs 47 minutes with LangGraph. However, when we added retry logic, parallel web searches, and a human approval step, LangGraph's explicit graph model actually saved time — the structure forces you to think through state transitions that ADK hides behind abstractions. For simple agents, ADK wins on speed. For complex agents, LangGraph wins on clarity."

— Alex Chen, AgDex Engineering

When to Choose Google ADK

ADK is the clear winner in several specific scenarios. If your team is already operating in the Google Cloud ecosystem — using Vertex AI for model hosting, BigQuery for data warehousing, Cloud Run for serverless deployments — the integration alone saves weeks of custom connector work. ADK's native Vertex AI tools mean you can connect to managed embeddings, vector search, and ML pipelines with a single import.

Already on Google Cloud

Native Vertex AI, BigQuery, Cloud Run, and Pub/Sub integrations. One import replaces hundreds of lines of custom connector code.

Enterprise Security & Compliance

Google Cloud's SOC 2, ISO 27001, and HIPAA compliance flows directly into ADK deployments on Vertex AI. Data residency, VPC-SC, and CMEK are all supported.

Multimodal Agents

Gemini's native image, video, and audio processing is first-class in ADK. Building agents that process PDFs, analyze charts, or transcribe meeting recordings requires no extra configuration.

Rapid Prototyping

ADK's Web UI lets you test and iterate on agents in a browser without writing a single line of frontend code. Invaluable for demos and stakeholder sign-off.

When to Choose LangGraph

LangGraph earns its complexity budget in specific high-value scenarios. If your agent needs to loop, retry, branch based on intermediate results, or pause for human review — LangGraph's graph model makes these patterns trivially composable. The explicit state typing also catches bugs early: when a node expects state["approved"] to be a bool and it gets None, you'll catch it in development rather than production.

Complex Control Flow

Agents that retry on failure, loop until a condition is met, or branch into parallel sub-tasks. LangGraph's conditional edges make these patterns clean and debuggable.

Human-in-the-Loop Workflows

LangGraph's interrupt() system natively pauses execution, stores state, and waits for human input. Essential for enterprise agents handling financial transactions, medical decisions, or customer-facing actions.

Existing LangChain Codebase

If you've already built retrievers, tool integrations, or prompt templates with LangChain, LangGraph slots in with zero migration cost. All LangChain tools work natively.

Production Observability

LangSmith provides step-by-step execution traces, automatic evaluation, and cost tracking. Every node's input/output is logged. Debugging a production issue means clicking through a visual trace, not grepping logs.

Combining ADK and LangGraph via A2A Protocol

The A2A (Agent-to-Agent) protocol, created by Google in 2025 and now adopted by both ADK and LangGraph, allows agents built on different frameworks to communicate using a standardized HTTP-based protocol. An ADK agent can advertise its capabilities via an "Agent Card" (a JSON manifest at /.well-known/agent.json), and a LangGraph orchestrator can discover and call it just like any other API.

This opens up a powerful architecture pattern: use LangGraph as the high-level orchestrator (handling complex state transitions, retries, and human approval flows), while delegating specialized tasks to ADK agents that have deep Google Cloud integrations. Each ADK agent runs as an independent microservice, making the system horizontally scalable.

Code Example 3: LangGraph Orchestrator Calling an ADK Agent via A2A

import httpx
import json
from langgraph.graph import StateGraph, END
from typing import TypedDict, List

# ---- ADK Agent (runs as a separate service on port 8080) ----
# This agent exposes an A2A-compatible endpoint
# Deploy with: adk deploy --a2a --port 8080

# ---- LangGraph Orchestrator (calls the ADK agent) ----

class OrchestratorState(TypedDict):
    task: str
    adk_agent_url: str
    adk_response: dict
    final_result: str
    status: str

async def call_adk_agent(state: OrchestratorState) -> OrchestratorState:
    """Node that calls the ADK agent via A2A protocol."""
    adk_url = state["adk_agent_url"]
    
    # A2A uses JSON-RPC over HTTP
    a2a_request = {
        "jsonrpc": "2.0",
        "method": "tasks/send",
        "params": {
            "id": "task_001",
            "message": {
                "role": "user",
                "parts": [{"type": "text", "text": state["task"]}]
            }
        },
        "id": 1
    }
    
    async with httpx.AsyncClient(timeout=30.0) as client:
        # First, fetch the agent's capability card
        card_resp = await client.get(f"{adk_url}/.well-known/agent.json")
        agent_card = card_resp.json()
        print(f"Calling ADK agent: {agent_card['name']}")
        
        # Send the task
        resp = await client.post(
            f"{adk_url}/a2a",
            json=a2a_request,
            headers={"Content-Type": "application/json"}
        )
        result = resp.json()
    
    return {
        "adk_response": result.get("result", {}),
        "status": "adk_complete"
    }

def synthesize_results(state: OrchestratorState) -> OrchestratorState:
    """Node that synthesizes the ADK agent response."""
    adk_data = state.get("adk_response", {})
    artifacts = adk_data.get("artifacts", [])
    
    final_text = "\n".join([
        a.get("parts", [{}])[0].get("text", "")
        for a in artifacts
    ])
    
    return {
        "final_result": final_text,
        "status": "complete"
    }

# Build the orchestration graph
workflow = StateGraph(OrchestratorState)
workflow.add_node("call_adk", call_adk_agent)
workflow.add_node("synthesize", synthesize_results)
workflow.set_entry_point("call_adk")
workflow.add_edge("call_adk", "synthesize")
workflow.add_edge("synthesize", END)

orchestrator = workflow.compile()

# Run: LangGraph orchestrates, ADK executes
import asyncio
result = asyncio.run(orchestrator.ainvoke({
    "task": "Analyze Q1 2026 sales data from BigQuery",
    "adk_agent_url": "http://localhost:8080",
    "status": "pending"
}))
print(result["final_result"])

Decision Matrix: 7-Dimension Scoring

Dimension Google ADK LangGraph Winner
Ease of Getting Started ⭐⭐⭐⭐⭐ ⭐⭐⭐ ADK
Control & Flexibility ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
Google Cloud Integration ⭐⭐⭐⭐⭐ ⭐⭐ ADK
Production Observability ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
Multi-Agent (A2A Native) ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐ ADK
Human-in-the-Loop ⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
Ökosystem & Integrations ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph

Decision Flowchart: How to Choose

START — What's your primary constraint?
├─ Using Google Cloud / Vertex AI?
└─ YES ──→ Google ADK ✓
├─ Need complex loops, retries, human approval?
└─ YES ──→ LangGraph ✓
├─ Existing LangChain codebase?
└─ YES ──→ LangGraph ✓
├─ Multimodal agent (images/video/audio)?
└─ YES ──→ Google ADK ✓
├─ Need max observability / LangSmith traces?
└─ YES ──→ LangGraph ✓
└─ Complex enterprise multi-agent system?
└─ YES ──→ LangGraph Orchestrator + ADK Agents via A2A ✓

Häufig gestellte Fragen

Is Google ADK free to use?

Google ADK itself is open-source and free (Apache 2.0 license). However, running agents on Google Cloud incurs costs: Vertex AI model inference (Gemini API calls), Cloud Run compute, and any other Google Cloud services your agent uses. You can also run ADK locally with any OpenAI-compatible model endpoint at zero cloud cost. The local development experience with the ADK Web UI is fully free and excellent for prototyping.

Can I use LangGraph without LangChain?

Yes — as of LangGraph 0.2+, you can use LangGraph as a standalone library without any LangChain dependencies. You define your state, nodes, and edges using pure Python, then plug in any LLM client (OpenAI, Anthropic, Gemini) directly. The LangSmith observability platform also works with standalone LangGraph. That said, if you want access to LangChain's 100+ LLM integrations and 1000+ tool connectors, they're a simple import away.

Which framework is better for production deployments?

Both are production-ready, but they excel in different scenarios. LangGraph has a longer production track record — it's been running at companies like Klarna, Elastic, and Replit since 2024. Its checkpointing, state persistence, and LangSmith traces are particularly strong for complex enterprise workflows. ADK is newer but backed by Google's production infrastructure; it's the safer choice for GCP-native deployments where you need Vertex AI's SLA guarantees and enterprise compliance. For most new projects, we'd recommend starting with LangGraph for anything complex and ADK for anything GCP-integrated.

Does Google ADK support local development without GCP?

Yes. ADK supports local development with any OpenAI-compatible model endpoint, including Ollama running locally. You can run adk web to launch the browser-based development UI without any cloud connectivity. Google Search and other Google tools require API keys, but you can substitute custom tools that don't. The GCP integrations (Vertex AI, BigQuery, etc.) activate when you deploy to Cloud Run or Vertex AI, but they're optional during development.

Can I migrate from LangGraph to ADK (or vice versa)?

Migration between frameworks is rarely a clean process — expect a partial rewrite rather than a port. The core agent logic (tool definitions, prompts, business rules) is portable, but the orchestration layer (state management, routing, persistence) is framework-specific. A pragmatic approach: instead of migrating, consider wrapping existing agents in A2A-compatible endpoints and building new agents in the target framework. This lets you incrementally move without a big-bang rewrite. Both frameworks support A2A, making this hybrid approach increasingly viable.

Comparison 2026年4月25日 14 min read

Google ADK vs LangGraph: Which AI エージェントフレームワーク Should You Use in 2026?

Two battle-hardened frameworks with fundamentally different design philosophies. Google ADK optimizes for Cloud integration and A2A-native multi-agent orchestration. LangGraph optimizes for explicit state management and fine-grained control flows. Here's everything you need to make the right call — including production code, benchmarks, and a decision matrix.

著者:Alex Chen · シニアエディター、AgDex · 2026年4月 · 最終更新: 2026年4月28日

Introduction: The State of エージェントフレームワークs in 2026

When Google unveiled the エージェント開発 Kit (ADK) at Google I/O 2025, the AI agent landscape shifted overnight. Here was a framework backed by the company that runs some of the world's largest AI deployments — not just an open-source experiment, but a battle-tested internal tool now opened to the public. 著者:Q1 2026, ADK had already accumulated over 18,000 GitHub stars and was being adopted rapidly by teams already embedded in the Google Cloud ecosystem.

Meanwhile, LangGraph — released by LangChain Inc. in early 2024 — had quietly become the de facto standard for production stateful agents. With over 12,000 GitHub stars and deep integration into the LangSmith observability platform, LangGraph powers agent workflows at companies including Elastic, Klarna, and Replit. Its graph-based execution model, while demanding a steeper learning curve, provides a level of control and debuggability that no other framework currently matches.

This article cuts through the marketing noise. We'll walk through real architecture differences, side-by-side code examples, performance observations from our own testing, and a clear decision framework for choosing — or combining — both.

Architecture Deep Dive

Google ADK: Agent → Runner → Session → Memory

ADK's architecture is layered and intentionally cloud-native. At the top sits the Agent — a declarative object that defines the model, tools, instructions, and optional sub-agents. Below that, the Runner handles execution lifecycle, including streaming, error handling, and async dispatch. The Session layer maintains conversation state across turns, while the Memory layer provides long-term storage via Vertex AI's managed memory services.

This layered approach means you can build a functional agent in under 20 lines of Python, but also scale it to complex multi-agent systems without rewriting your core logic. The deep integration with Vertex AI is both a strength and a constraint — you get managed embeddings, vector search, and model endpoints for free, but you're also firmly inside the Google Cloud wall.

Code Example 1: Building a Research Agent with Google ADK

from google.adk.agents import Agent
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from google.adk.tools import google_search
from google.genai import types

# Define a custom tool
def analyze_data(query: str, data_source: str) -> dict:
    """Fetch and analyze data from BigQuery or structured sources."""
    # In production, this calls BigQuery or your data warehouse
    return {
        "query": query,
        "source": data_source,
        "result": f"Analysis for '{query}' from {data_source}",
        "confidence": 0.92
    }

# Create the agent - declarative, clean, minimal boilerplate
research_agent = Agent(
    name="research_agent",
    model="gemini-2.0-flash-exp",
    description="A research agent that searches the web and analyzes data",
    instruction="""You are an expert research analyst. When given a research task:
    1. Use google_search to find current information
    2. Use analyze_data to process structured data sources
    3. Always cite your sources
    4. Provide a confidence score for your findings""",
    tools=[google_search, analyze_data],
)

# Set up session management
session_service = InMemorySessionService()
session = session_service.create_session(
    app_name="research_app",
    user_id="user_001",
    session_id="session_abc123"
)

# Runner handles the execution lifecycle
runner = Runner(
    agent=research_agent,
    app_name="research_app",
    session_service=session_service
)

# Execute a research task
async def run_research(query: str):
    user_message = types.Content(
        role="user",
        parts=[types.Part(text=query)]
    )
    async for event in runner.run_async(
        user_id="user_001",
        session_id="session_abc123",
        new_message=user_message
    ):
        if event.is_final_response():
            print(event.content.parts[0].text)

import asyncio
asyncio.run(run_research("What are the top AI agent frameworks in 2026?"))

LangGraph: StateGraph → Node → Edge → Checkpoint

LangGraph models agent execution as a directed graph where Nodes are processing functions (call an LLM, execute a tool, route a decision) and Edges define transitions between nodes — including conditional edges that implement branching and looping logic. The StateGraph holds a typed state dictionary that flows through every node, making it trivial to inspect exactly what data exists at any point in the workflow. The Checkpoint system provides durable persistence: if a workflow pauses (for human approval or an async operation), it can be resumed from exactly where it left off.

This design shines for complex agents that need retries, parallel branches, human-in-the-loop interrupts, and intricate conditional routing. The verbosity is intentional — every transition is explicit, which makes debugging and auditing dramatically easier in production environments.

Code Example 2: Equivalent Research Agent with LangGraph

from langgraph.graph import StateGraph, END
from langgraph.checkpoint.memory import MemorySaver
from langchain_openai import ChatOpenAI
from langchain_community.tools import DuckDuckGoSearchRun
from langchain_core.messages import HumanMessage, AIMessage
from typing import TypedDict, Annotated, List
import operator

# Explicitly typed state - you always know what's in play
class ResearchState(TypedDict):
    messages: Annotated[List, operator.add]
    research_query: str
    search_results: List[str]
    analysis: str
    iteration_count: int
    approved: bool

# Initialize tools and model
search_tool = DuckDuckGoSearchRun()
llm = ChatOpenAI(model="gpt-4o", temperature=0)

# Node 1: Search the web
def search_node(state: ResearchState) -> ResearchState:
    query = state["research_query"]
    results = search_tool.run(query)
    return {
        "search_results": [results],
        "messages": [AIMessage(content=f"Search completed for: {query}")]
    }

# Node 2: Analyze results
def analyze_node(state: ResearchState) -> ResearchState:
    context = "\n".join(state["search_results"])
    response = llm.invoke([
        HumanMessage(content=f"Analyze these search results for '{state['research_query']}':\n{context}")
    ])
    return {
        "analysis": response.content,
        "iteration_count": state.get("iteration_count", 0) + 1,
        "messages": [response]
    }

# Node 3: Quality check with potential retry
def quality_check_node(state: ResearchState) -> ResearchState:
    analysis = state["analysis"]
    is_sufficient = len(analysis) > 200 and state["iteration_count"] < 3
    return {"approved": is_sufficient}

# Conditional routing function
def should_retry(state: ResearchState) -> str:
    if state["approved"]:
        return "done"
    elif state["iteration_count"] >= 3:
        return "done"  # Give up after 3 tries
    else:
        return "retry"

# Build the graph
workflow = StateGraph(ResearchState)
workflow.add_node("search", search_node)
workflow.add_node("analyze", analyze_node)
workflow.add_node("quality_check", quality_check_node)

workflow.set_entry_point("search")
workflow.add_edge("search", "analyze")
workflow.add_edge("analyze", "quality_check")
workflow.add_conditional_edges(
    "quality_check",
    should_retry,
    {"done": END, "retry": "search"}  # Retry loop!
)

# Compile with persistence
memory = MemorySaver()
app = workflow.compile(checkpointer=memory)

# Execute with thread tracking
result = app.invoke(
    {"research_query": "Top AI agent frameworks 2026", "iteration_count": 0},
    config={"configurable": {"thread_id": "research_001"}}
)
print(result["analysis"])

Performance & Developer Experience

Dimension Google ADK LangGraph
Cold Start Time ~1.2s ~2.1s (LangChain overhead)
Lines of Code (simple agent) ~25 lines ~60 lines
学習曲線 Moderate (1–2 days) Steep (3–5 days)
ドキュメント Quality Good (improving fast) Excellent (LangSmith docs)
GitHub Stars (Apr 2026) ~18,000 ~12,000 (mature)
Cloud Integration Native (Google Cloud) Provider-agnostic
Local Development ADK Web UI (excellent) LangGraph Studio (very good)
マルチエージェント (A2A) Native (Google created A2A) Supported via adapters

"In our testing, building the same 3-node research agent took 22 minutes with ADK vs 47 minutes with LangGraph. However, when we added retry logic, parallel web searches, and a human approval step, LangGraph's explicit graph model actually saved time — the structure forces you to think through state transitions that ADK hides behind abstractions. For simple agents, ADK wins on speed. For complex agents, LangGraph wins on clarity."

— Alex Chen, AgDex Engineering

When to Choose Google ADK

ADK is the clear winner in several specific scenarios. If your team is already operating in the Google Cloud ecosystem — using Vertex AI for model hosting, BigQuery for data warehousing, Cloud Run for serverless deployments — the integration alone saves weeks of custom connector work. ADK's native Vertex AI tools mean you can connect to managed embeddings, vector search, and ML pipelines with a single import.

Already on Google Cloud

Native Vertex AI, BigQuery, Cloud Run, and Pub/Sub integrations. One import replaces hundreds of lines of custom connector code.

Enterprise Security & Compliance

Google Cloud's SOC 2, ISO 27001, and HIPAA compliance flows directly into ADK deployments on Vertex AI. Data residency, VPC-SC, and CMEK are all supported.

Multimodal Agents

Gemini's native image, video, and audio processing is first-class in ADK. Building agents that process PDFs, analyze charts, or transcribe meeting recordings requires no extra configuration.

Rapid Prototyping

ADK's Web UI lets you test and iterate on agents in a browser without writing a single line of frontend code. Invaluable for demos and stakeholder sign-off.

When to Choose LangGraph

LangGraph earns its complexity budget in specific high-value scenarios. If your agent needs to loop, retry, branch based on intermediate results, or pause for human review — LangGraph's graph model makes these patterns trivially composable. The explicit state typing also catches bugs early: when a node expects state["approved"] to be a bool and it gets None, you'll catch it in development rather than production.

Complex Control Flow

Agents that retry on failure, loop until a condition is met, or branch into parallel sub-tasks. LangGraph's conditional edges make these patterns clean and debuggable.

Human-in-the-Loop Workflows

LangGraph's interrupt() system natively pauses execution, stores state, and waits for human input. Essential for enterprise agents handling financial transactions, medical decisions, or customer-facing actions.

Existing LangChain Codebase

If you've already built retrievers, tool integrations, or prompt templates with LangChain, LangGraph slots in with zero migration cost. All LangChain tools work natively.

Production Observability

LangSmith provides step-by-step execution traces, automatic evaluation, and cost tracking. Every node's input/output is logged. Debugging a production issue means clicking through a visual trace, not grepping logs.

Combining ADK and LangGraph via A2A Protocol

The A2A (Agent-to-Agent) protocol, created by Google in 2025 and now adopted by both ADK and LangGraph, allows agents built on different frameworks to communicate using a standardized HTTP-based protocol. An ADK agent can advertise its capabilities via an "Agent Card" (a JSON manifest at /.well-known/agent.json), and a LangGraph orchestrator can discover and call it just like any other API.

This opens up a powerful architecture pattern: use LangGraph as the high-level orchestrator (handling complex state transitions, retries, and human approval flows), while delegating specialized tasks to ADK agents that have deep Google Cloud integrations. Each ADK agent runs as an independent microservice, making the system horizontally scalable.

Code Example 3: LangGraph Orchestrator Calling an ADK Agent via A2A

import httpx
import json
from langgraph.graph import StateGraph, END
from typing import TypedDict, List

# ---- ADK Agent (runs as a separate service on port 8080) ----
# This agent exposes an A2A-compatible endpoint
# Deploy with: adk deploy --a2a --port 8080

# ---- LangGraph Orchestrator (calls the ADK agent) ----

class OrchestratorState(TypedDict):
    task: str
    adk_agent_url: str
    adk_response: dict
    final_result: str
    status: str

async def call_adk_agent(state: OrchestratorState) -> OrchestratorState:
    """Node that calls the ADK agent via A2A protocol."""
    adk_url = state["adk_agent_url"]
    
    # A2A uses JSON-RPC over HTTP
    a2a_request = {
        "jsonrpc": "2.0",
        "method": "tasks/send",
        "params": {
            "id": "task_001",
            "message": {
                "role": "user",
                "parts": [{"type": "text", "text": state["task"]}]
            }
        },
        "id": 1
    }
    
    async with httpx.AsyncClient(timeout=30.0) as client:
        # First, fetch the agent's capability card
        card_resp = await client.get(f"{adk_url}/.well-known/agent.json")
        agent_card = card_resp.json()
        print(f"Calling ADK agent: {agent_card['name']}")
        
        # Send the task
        resp = await client.post(
            f"{adk_url}/a2a",
            json=a2a_request,
            headers={"Content-Type": "application/json"}
        )
        result = resp.json()
    
    return {
        "adk_response": result.get("result", {}),
        "status": "adk_complete"
    }

def synthesize_results(state: OrchestratorState) -> OrchestratorState:
    """Node that synthesizes the ADK agent response."""
    adk_data = state.get("adk_response", {})
    artifacts = adk_data.get("artifacts", [])
    
    final_text = "\n".join([
        a.get("parts", [{}])[0].get("text", "")
        for a in artifacts
    ])
    
    return {
        "final_result": final_text,
        "status": "complete"
    }

# Build the orchestration graph
workflow = StateGraph(OrchestratorState)
workflow.add_node("call_adk", call_adk_agent)
workflow.add_node("synthesize", synthesize_results)
workflow.set_entry_point("call_adk")
workflow.add_edge("call_adk", "synthesize")
workflow.add_edge("synthesize", END)

orchestrator = workflow.compile()

# Run: LangGraph orchestrates, ADK executes
import asyncio
result = asyncio.run(orchestrator.ainvoke({
    "task": "Analyze Q1 2026 sales data from BigQuery",
    "adk_agent_url": "http://localhost:8080",
    "status": "pending"
}))
print(result["final_result"])

Decision Matrix: 7-Dimension Scoring

Dimension Google ADK LangGraph Winner
Ease of Getting Started ⭐⭐⭐⭐⭐ ⭐⭐⭐ ADK
Control & Flexibility ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
Google Cloud Integration ⭐⭐⭐⭐⭐ ⭐⭐ ADK
Production Observability ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
マルチエージェント (A2A Native) ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐ ADK
Human-in-the-Loop ⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
エコシステム & Integrations ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph

Decision Flowchart: How to Choose

START — What's your primary constraint?
├─ Using Google Cloud / Vertex AI?
└─ YES ──→ Google ADK ✓
├─ Need complex loops, retries, human approval?
└─ YES ──→ LangGraph ✓
├─ Existing LangChain codebase?
└─ YES ──→ LangGraph ✓
├─ Multimodal agent (images/video/audio)?
└─ YES ──→ Google ADK ✓
├─ Need max observability / LangSmith traces?
└─ YES ──→ LangGraph ✓
└─ Complex enterprise multi-agent system?
└─ YES ──→ LangGraph Orchestrator + ADK Agents via A2A ✓

よくある質問

Is Google ADK free to use?

Google ADK itself is open-source and free (Apache 2.0 license). However, running agents on Google Cloud incurs costs: Vertex AI model inference (Gemini API calls), Cloud Run compute, and any other Google Cloud services your agent uses. You can also run ADK locally with any OpenAI-compatible model endpoint at zero cloud cost. The local development experience with the ADK Web UI is fully free and excellent for prototyping.

Can I use LangGraph without LangChain?

Yes — as of LangGraph 0.2+, you can use LangGraph as a standalone library without any LangChain dependencies. You define your state, nodes, and edges using pure Python, then plug in any LLM client (OpenAI, Anthropic, Gemini) directly. The LangSmith observability platform also works with standalone LangGraph. That said, if you want access to LangChain's 100+ LLM integrations and 1000+ tool connectors, they're a simple import away.

Which framework is better for production deployments?

Both are production-ready, but they excel in different scenarios. LangGraph has a longer production track record — it's been running at companies like Klarna, Elastic, and Replit since 2024. Its checkpointing, state persistence, and LangSmith traces are particularly strong for complex enterprise workflows. ADK is newer but backed by Google's production infrastructure; it's the safer choice for GCP-native deployments where you need Vertex AI's SLA guarantees and enterprise compliance. For most new projects, we'd recommend starting with LangGraph for anything complex and ADK for anything GCP-integrated.

Does Google ADK support local development without GCP?

Yes. ADK supports local development with any OpenAI-compatible model endpoint, including Ollama running locally. You can run adk web to launch the browser-based development UI without any cloud connectivity. Google Search and other Google tools require API keys, but you can substitute custom tools that don't. The GCP integrations (Vertex AI, BigQuery, etc.) activate when you deploy to Cloud Run or Vertex AI, but they're optional during development.

Can I migrate from LangGraph to ADK (or vice versa)?

Migration between frameworks is rarely a clean process — expect a partial rewrite rather than a port. The core agent logic (tool definitions, prompts, business rules) is portable, but the orchestration layer (state management, routing, persistence) is framework-specific. A pragmatic approach: instead of migrating, consider wrapping existing agents in A2A-compatible endpoints and building new agents in the target framework. This lets you incrementally move without a big-bang rewrite. Both frameworks support A2A, making this hybrid approach increasingly viable.

مقارنة 25 أبريل 2026 قراءة في 14 دقيقة

Google ADK مقابل LangGraph: أي إطار عمل لوكلاء الذكاء الاصطناعي ينبغي لك استخدامه في عام 2026؟

إطاران مجربان في المعارك بفلسفات تصميم مختلفة تمامًا. تحسن Google ADK من أجل التكامل السحابي وتنسيق الأنظمة متعددة الوكلاء القائمة على بروتوكول A2A. بينما تحسن LangGraph من أجل الإدارة الصريحة للحالة وتدفقات التحكم دقيقة التوجيه. إليك كل ما تحتاجه لاتخاذ القرار الصائب — بما في ذلك كود البرمجة الخاص ببيئة الإنتاج، واختبارات الأداء، ومصفوفة اتخاذ القرار.

بقلم أليكس تشن · رئيس المحررين، AgDex · أبريل 2026 · آخر تحديث: 28 أبريل 2026

مقدمة: حالة أطر عمل الوكلاء في عام 2026

عندما كشفت Google عن حزمة تطوير الوكلاء (Agent Development Kit - ADK) في مؤتمر Google I/O 2025، تغير المشهد العام لوكلاء الذكاء الاصطناعي بين عشية وضحاها. لقد أصبح لدينا إطار عمل مدعوم من الشركة التي تدير أضخم عمليات نشر للذكاء الاصطناعي في العالم — فهو ليس مجرد تجربة مفتوحة المصدر، بل أداة داخلية صلبة تم فتحها للجمهور. وبحلول الربع الأول من عام 2026، كان ADK قد جمع بالفعل أكثر من 18,000 نجمة على GitHub، وبدأ اعتماده بسرعة من قبل الفرق المستقرة بالفعل في نظام Google Cloud البيئي.

في الوقت نفسه، أصبح LangGraph — الذي أطلقته شركة LangChain Inc. في أواخر عام 2024 — المعيار الفعلي (de facto) للوكلاء ذوي الحالة (stateful agents) في بيئات الإنتاج. مع أكثر من 12,000 نجمة على GitHub وتكامل عميق مع منصة المراقبة والقابلية للملاحظة LangSmith، يدير LangGraph تدفقات عمل الوكلاء في شركات كبرى مثل Elastic وKlarna وReplit. وعلى الرغم من أن نموذج التنفيذ القائم على الرسم البياني (Graph-based execution) يتطلب منحنى تعلم أكثر صعوبة، إلا أنه يقدم مستوى من التحكم وقابلية تصحيح الأخطاء لا يضاهيه أي إطار عمل آخر حاليًا.

تتجاوز هذه المقالة الشعارات التسويقية. سنتطرق إلى الاختلافات المعمارية الحقيقية، وأمثلة الكود المتجاور، وملاحظات الأداء من اختباراتنا الخاصة، وإطار عمل واضح لاتخاذ القرار سواء لاختيار أحدهما أو الدمج بينهما.

التعمق في البنية الهيكلية

Google ADK: الوكيل ← المشغل ← الجلسة ← الذاكرة

تتميز بنية ADK بأنها متعددة الطبقات ومصممة خصيصًا للتطبيقات السحابية الأصلية (cloud-native). في الأعلى يقع الوكيل (Agent) — وهو كائن تصريحي يحدد النموذج، والأدوات، والتعليمات، والوكلاء الفرعيين الاختياريين. تحت ذلك، يتولى المشغل (Runner) إدارة دورة حياة التنفيذ، بما في ذلك التدفق (streaming)، ومعالجة الأخطاء، والتوزيع غير المتزامن. بينما تحافظ طبقة الجلسة (Session) على حالة المحادثة عبر التبادلات المختلفة، في حين توفر طبقة الذاكرة (Memory) تخزينًا طويل الأمد عبر خدمات الذاكرة المدارة في Vertex AI.

يعني هذا النهج متعدد الطبقات أنه يمكنك بناء وكيل وظيفي في أقل من 20 سطرًا من كود Python، وفي الوقت نفسه توسيعه إلى أنظمة معقدة متعددة الوكلاء دون إعادة كتابة المنطق الأساسي. يعد التكامل العميق مع Vertex AI مصدر قوة وقيدًا في آن واحد — فإنه يمنحك تضمينات (embeddings) مدارة، وبحثًا موجهًا (vector search)، ونقاط نهاية للنماذج مجانًا، ولكنك تظل محصورًا داخل بيئة Google Cloud.

مثال برمجي 1: بناء وكيل أبحاث باستخدام Google ADK

from google.adk.agents import Agent
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from google.adk.tools import google_search
from google.genai import types

# Define a custom tool
def analyze_data(query: str, data_source: str) -> dict:
    """Fetch and analyze data from BigQuery or structured sources."""
    # In production, this calls BigQuery or your data warehouse
    return {
        "query": query,
        "source": data_source,
        "result": f"Analysis for '{query}' from {data_source}",
        "confidence": 0.92
    }

# Create the agent - declarative, clean, minimal boilerplate
research_agent = Agent(
    name="research_agent",
    model="gemini-2.0-flash-exp",
    description="A research agent that searches the web and analyzes data",
    instruction="""You are an expert research analyst. When given a research task:
    1. Use google_search to find current information
    2. Use analyze_data to process structured data sources
    3. Always cite your sources
    4. Provide a confidence score for your findings""",
    tools=[google_search, analyze_data],
)

# Set up session management
session_service = InMemorySessionService()
session = session_service.create_session(
    app_name="research_app",
    user_id="user_001",
    session_id="session_abc123"
)

# Runner handles the execution lifecycle
runner = Runner(
    agent=research_agent,
    app_name="research_app",
    session_service=session_service
)

# Execute a research task
async def run_research(query: str):
    user_message = types.Content(
        role="user",
        parts=[types.Part(text=query)]
    )
    async for event in runner.run_async(
        user_id="user_001",
        session_id="session_abc123",
        new_message=user_message
    ):
        if event.is_final_response():
            print(event.content.parts[0].text)

import asyncio
asyncio.run(run_research("What are the top AI agent frameworks in 2026?"))

LangGraph: StateGraph ← العقدة ← الحافة ← نقطة التحقق

ينمذج LangGraph تنفيذ الوكيل كـ رسم بياني موجه (directed graph) حيث تكون العقد (Nodes) عبارة عن دواءل معالجة (استدعاء نموذج لغوي كبير، تنفيذ أداة، توجيه قرار) وتحدد الحواف (Edges) الانتقالات بين العقد — بما في ذلك الحواف الشرطية التي تنفذ منطق التفريع والتكرار. يحتفظ StateGraph بقاموس حالة محدد النوع يتدفق عبر كل عقدة، مما يجعل فحص البيانات الموجودة في أي نقطة في مسار العمل أمرًا بسيطًا للغاية. يوفر نظام نقطة التحقق (Checkpoint) استمرارية دائمة: إذا توقف مسار العمل مؤقتًا (للحصول على موافقة بشرية أو عملية غير متزامنة)، يمكن استئنافه تمامًا من حيث توقف.

يتألق هذا التصميم في الوكلاء المعقدين الذين يحتاجون إلى إعادة المحاولة، والفروع المتوازية، وتدخلات العنصر البشري في المسار (human-in-the-loop interrupts)، والتوجيه الشرطي المعقد. الإطالة في التفاصيل مقصودة هنا — فكل انتقال يكون صريحًا، مما يجعل تصحيح الأخطاء والمراجعة أسهل بكثير في بيئات الإنتاج.

مثال برمجي 2: وكيل أبحاث مكافئ باستخدام LangGraph

from langgraph.graph import StateGraph, END
from langgraph.checkpoint.memory import MemorySaver
from langchain_openai import ChatOpenAI
from langchain_community.tools import DuckDuckGoSearchRun
from langchain_core.messages import HumanMessage, AIMessage
from typing import TypedDict, Annotated, List
import operator

# Explicitly typed state - you always know what's in play
class ResearchState(TypedDict):
    messages: Annotated[List, operator.add]
    research_query: str
    search_results: List[str]
    analysis: str
    iteration_count: int
    approved: bool

# Initialize tools and model
search_tool = DuckDuckGoSearchRun()
llm = ChatOpenAI(model="gpt-4o", temperature=0)

# Node 1: Search the web
def search_node(state: ResearchState) -> ResearchState:
    query = state["research_query"]
    results = search_tool.run(query)
    return {
        "search_results": [results],
        "messages": [AIMessage(content=f"Search completed for: {query}")]
    }

# Node 2: Analyze results
def analyze_node(state: ResearchState) -> ResearchState:
    context = "\n".join(state["search_results"])
    response = llm.invoke([
        HumanMessage(content=f"Analyze these search results for '{state['research_query']}':\n{context}")
    ])
    return {
        "analysis": response.content,
        "iteration_count": state.get("iteration_count", 0) + 1,
        "messages": [response]
    }

# Node 3: Quality check with potential retry
def quality_check_node(state: ResearchState) -> ResearchState:
    analysis = state["analysis"]
    is_sufficient = len(analysis) > 200 and state["iteration_count"] < 3
    return {"approved": is_sufficient}

# Conditional routing function
def should_retry(state: ResearchState) -> str:
    if state["approved"]:
        return "done"
    elif state["iteration_count"] >= 3:
        return "done"  # Give up after 3 tries
    else:
        return "retry"

# Build the graph
workflow = StateGraph(ResearchState)
workflow.add_node("search", search_node)
workflow.add_node("analyze", analyze_node)
workflow.add_node("quality_check", quality_check_node)

workflow.set_entry_point("search")
workflow.add_edge("search", "analyze")
workflow.add_edge("analyze", "quality_check")
workflow.add_conditional_edges(
    "quality_check",
    should_retry,
    {"done": END, "retry": "search"}  # Retry loop!
)

# Compile with persistence
memory = MemorySaver()
app = workflow.compile(checkpointer=memory)

# Execute with thread tracking
result = app.invoke(
    {"research_query": "Top AI agent frameworks 2026", "iteration_count": 0},
    config={"configurable": {"thread_id": "research_001"}}
)
print(result["analysis"])

الأداء وتجربة المطورين (DX)

البُعد Google ADK LangGraph
زمن البدء البارد (Cold Start) ~1.2 ثانية ~2.1 ثانية (عبء إضافي لـ LangChain)
عدد أسطر البرمجة (وكيل بسيط) ~25 سطرًا ~60 سطرًا
منحنى التعلم متوسط (1–2 يوم) شديد الانحدار (3–5 أيام)
جودة التوثيق جيدة (تتحسن بسرعة) ممتازة (وثائق LangSmith)
نجوم GitHub (أبريل 2026) ~18,000 ~12,000 (ناضج)
التكامل السحابي أصلي (Google Cloud) محايد تجاه مزودي السحابة
التطوير المحلي واجهة ADK Web UI (ممتازة) LangGraph Studio (جيدة جدًا)
تعدد الوكلاء (A2A) أصلي (ابتكرت Google بروتوكول A2A) مدعوم عبر محولات (adapters)

"في اختباراتنا، استغرق بناء نفس وكيل الأبحاث المكون من 3 عقد 22 دقيقة مع ADK مقابل 47 دقيقة مع LangGraph. ولكن عندما أضفنا منطق إعادة المحاولة، والبحث المتوازي في الويب، ومرحلة موافقة بشرية، وفر النموذج القائم على الرسم البياني الصريح في LangGraph الوقت في الواقع — فالنية الهيكلية تجبرك على التفكير في انتقالات الحالة التي يخفيها ADK خلف التجريدات. بالنسبة للوكلاء البسيطين، يفوز ADK بالسرعة. أما بالنسبة للوكلاء المعقدين، فيفوز LangGraph بالوضوح."

— أليكس تشن، هندسة AgDex

متى تختار Google ADK

يعد ADK الفائز الواضح في العديد من السيناريوهات المحددة. إذا كان فريقك يعمل بالفعل في نظام Google Cloud البيئي — حيث يستخدم Vertex AI لاستضافة النماذج، وBigQuery لمستودعات البيانات، وCloud Run للنشر الخالي من السيرفرات (serverless) — فإن التكامل وحده يوفر أسابيع من عمل الربط المخصص. تعني أدوات Vertex AI الأصلية في ADK أنه يمكنك الاتصال بالتضمينات المدارة، والبحث الموجه، ومسارات تعلم الآلة من خلال استيراد واحد فقط.

تستخدم Google Cloud بالفعل

تكاملات أصلية مع Vertex AI وBigQuery وCloud Run وPub/Sub. يستبدل أمر استيراد واحد مئات الأسطر من كود الربط المخصص.

الأمان والامتثال على مستوى المؤسسات

تنتقل معايير الامتثال SOC 2 وISO 27001 وHIPAA في Google Cloud مباشرة إلى عمليات نشر ADK على Vertex AI. مع دعم كامل لإقامة البيانات وVPC-SC وCMEK.

الوكلاء متعددو الوسائط (Multimodal Agents)

تعد معالجة الصور والفيديو والصوت الأصلية في Gemini ميزة من الدرجة الأولى في ADK. لا تتطلب عملية بناء وكلاء يعالجون ملفات PDF، أو يحللون الرسوم البيانية، أو يفرغون تسجيلات الاجتماعات أي إعدادات إضافية.

التطوير السريع للنماذج الأولية

تتيح لك واجهة المتصفح (Web UI) في ADK اختبار الوكلاء والتعديل عليهم في متصفح الويب دون كتابة سطر كود واحد للواجهة الأمامية. وهي أداة قيمة جدًا للعروض التوضيحية وأخذ موافقات أصحاب المصلحة.

متى تختار LangGraph

يستحق LangGraph تعقيده في سيناريوهات عالية القيمة محددة. إذا كان وكيلك يحتاج إلى التكرار في حلقات، أو إعادة المحاولة، أو التفريع بناءً على نتائج مرحلية، أو التوقف المؤقت للمراجعة البشرية — فإن نموذج الرسم البياني في LangGraph يجعل هذه الأنماط سهلة التركيب للغاية. كما يكتشف التحديد الصريح لأنواع الحالة الأخطاء مبكرًا: فعندما تتوقع عقدة ما أن يكون state["approved"] من نوع bool لكنه يتلقى None، ستكتشف ذلك أثناء التطوير بدلاً من بيئة الإنتاج.

تدفقات التحكم المعقدة

الوكلاء الذين يعيدون المحاولة عند الفشل، أو يكررون التنفيذ حتى تحقق شرط معين، أو يتفرعون إلى مهام فرعية متوازية. تجعل الحواف الشرطية في LangGraph هذه الأنماط نظيفة وقابلة للتصحيح.

مسارات عمل تتطلب تدخلاً بشرياً (Human-in-the-Loop)

يقوم نظام ()interrupt في LangGraph بإيقاف التنفيذ مؤقتًا بشكل أصلي، ويخزن الحالة، وينتظر المدخلات البشرية. وهو أمر أساسي لوكلاء المؤسسات الذين يتعاملون مع المعاملات المالية، أو القرارات الطبية، أو الإجراءات المواجهة للعملاء.

قواعد الكود الحالية القائمة على LangChain

إذا كنت قد بنيت بالفعل أدوات استرجاع (retrievers)، أو تكاملات أدوات، أو قوالب أوامر باستخدام LangChain، فإن LangGraph ينضم إليها بدون أي تكلفة انتقال. تعمل جميع أدوات LangChain بشكل أصلي.

القابلية للملاحظة في بيئة الإنتاج

يوفر LangSmith تتبعًا للتنفيذ خطوة بخطوة، وتقييمًا أوتوماتيكيًا، ومتابعة للتكاليف. يُسجل كل مدخل/مخرج لكل عقدة. يعني تصحيح مشكلة في الإنتاج النقر عبر تتبع بصري بدلاً من البحث في السجلات.

الدمج بين ADK وLangGraph عبر بروتوكول A2A

يتيح بروتوكول A2A (من وكيل إلى وكيل - Agent-to-Agent)، الذي ابتكرته Google في عام 2025 واعتمدته كل من ADK وLangGraph، للوكلاء المبنيين على أطر عمل مختلفة التواصل مع بعضهم البعض باستخدام بروتوكول قياسي قائم على HTTP. يمكن لوكيل ADK الإعلان عن إمكانياته عبر "بطاقة الوكيل" (بيان JSON على /.well-known/agent.json)، بينما يمكن لمنسق LangGraph اكتشافه واستدعائه تمامًا مثل أي API آخر.

يفتح هذا المجال لنمط معماري قوي: استخدام LangGraph كمنسق رفيع المستوى (يتعامل مع انتقالات الحالة المعقدة، وإعادات المحاولة، وتدفقات الموافقة البشرية)، مع تفويض المهام المتخصصة لوكلاء ADK الذين يملكون تكاملات عميقة مع Google Cloud. يعمل كل وكيل ADK كخدمة مصغرة (microservice) مستقلة، مما يجعل النظام قابلًا للتوسع أفقيًا.

مثال برمجي 3: منسق LangGraph يستدعي وكيل ADK عبر بروتوكول A2A

import httpx
import json
from langgraph.graph import StateGraph, END
from typing import TypedDict, List

# ---- ADK Agent (runs as a separate service on port 8080) ----
# This agent exposes an A2A-compatible endpoint
# Deploy with: adk deploy --a2a --port 8080

# ---- LangGraph Orchestrator (calls the ADK agent) ----

class OrchestratorState(TypedDict):
    task: str
    adk_agent_url: str
    adk_response: dict
    final_result: str
    status: str

async def call_adk_agent(state: OrchestratorState) -> OrchestratorState:
    """Node that calls the ADK agent via A2A protocol."""
    adk_url = state["adk_agent_url"]
    
    # A2A uses JSON-RPC over HTTP
    a2a_request = {
        "jsonrpc": "2.0",
        "method": "tasks/send",
        "params": {
            "id": "task_001",
            "message": {
                "role": "user",
                "parts": [{"type": "text", "text": state["task"]}]
            }
        },
        "id": 1
    }
    
    async with httpx.AsyncClient(timeout=30.0) as client:
        # First, fetch the agent's capability card
        card_resp = await client.get(f"{adk_url}/.well-known/agent.json")
        agent_card = card_resp.json()
        print(f"Calling ADK agent: {agent_card['name']}")
        
        # Send the task
        resp = await client.post(
            f"{adk_url}/a2a",
            json=a2a_request,
            headers={"Content-Type": "application/json"}
        )
        result = resp.json()
    
    return {
        "adk_response": result.get("result", {}),
        "status": "adk_complete"
    }

def synthesize_results(state: OrchestratorState) -> OrchestratorState:
    """Node that synthesizes the ADK agent response."""
    adk_data = state.get("adk_response", {})
    artifacts = adk_data.get("artifacts", [])
    
    final_text = "\n".join([
        a.get("parts", [{}])[0].get("text", "")
        for a in artifacts
    ])
    
    return {
        "final_result": final_text,
        "status": "complete"
    }

# Build the orchestration graph
workflow = StateGraph(OrchestratorState)
workflow.add_node("call_adk", call_adk_agent)
workflow.add_node("synthesize", synthesize_results)
workflow.set_entry_point("call_adk")
workflow.add_edge("call_adk", "synthesize")
workflow.add_edge("synthesize", END)

orchestrator = workflow.compile()

# Run: LangGraph orchestrates, ADK executes
import asyncio
result = asyncio.run(orchestrator.ainvoke({
    "task": "Analyze Q1 2026 sales data from BigQuery",
    "adk_agent_url": "http://localhost:8080",
    "status": "pending"
}))
print(result["final_result"])

مصفوفة القرار: تقييم عبر 7 أبعاد

البُعد Google ADK LangGraph الفائز
سهولة البدء والاستخدام ⭐⭐⭐⭐⭐ ⭐⭐⭐ ADK
التحكم والمرونة ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
التكامل مع Google Cloud ⭐⭐⭐⭐⭐ ⭐⭐ ADK
القابلية للملاحظة في بيئة الإنتاج ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
تعدد الوكلاء (دعم A2A أصلي) ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐ ADK
التدخل البشري (Human-in-the-Loop) ⭐⭐ ⭐⭐⭐⭐⭐ LangGraph
النظام البيئي والتكاملات ⭐⭐⭐ ⭐⭐⭐⭐⭐ LangGraph

مخطط تدفق القرار: كيف تختار؟

START — What's your primary constraint?
├─ Using Google Cloud / Vertex AI?
└─ YES ──→ Google ADK ✓
├─ Need complex loops, retries, human approval?
└─ YES ──→ LangGraph ✓
├─ Existing LangChain codebase?
└─ YES ──→ LangGraph ✓
├─ Multimodal agent (images/video/audio)?
└─ YES ──→ Google ADK ✓
├─ Need max observability / LangSmith traces?
└─ YES ──→ LangGraph ✓
└─ Complex enterprise multi-agent system?
└─ YES ──→ LangGraph Orchestrator + ADK Agents via A2A ✓

الأسئلة الشائعة

هل استخدام Google ADK مجاني؟

Google ADK نفسه مفتوح المصدر ومجاني (بترخيص Apache 2.0). ومع ذلك، فإن تشغيل الوكلاء على Google Cloud يترتب عليه تكاليف: استنتاج نماذج Vertex AI (استدعاءات Gemini API)، والحوسبة في Cloud Run، وأي خدمات Google Cloud أخرى يستخدمها وكيلك. يمكنك أيضًا تشغيل ADK محليًا مع أي نقطة نهاية نموذج متوافقة مع OpenAI بدون تكلفة سحابية. كما أن تجربة التطوير المحلي مع واجهة ADK Web UI مجانية بالكامل وممتازة لبناء النماذج الأولية.

هل يمكنني استخدام LangGraph بدون LangChain؟

نعم — اعتبارًا من إصدار LangGraph 0.2+، يمكنك استخدام LangGraph كمكتبة مستقلة تمامًا دون أي اعتماد على LangChain. يمكنك تحديد حالتك وعقدك وحوافك باستخدام كود Python خالص، ثم توصيل أي عميل نموذج لغوي كبير (OpenAI أو Anthropic أو Gemini) مباشرة. تعمل منصة المراقبة LangSmith أيضًا مع LangGraph المستقل. ومع ذلك، إذا كنت تريد الوصول إلى أكثر من 100 تكامل للنماذج و1000+ موصل أدوات في LangChain، فيمكنك استيرادها بكل سهولة.

أي إطار عمل هو الأفضل لعمليات النشر في بيئة الإنتاج؟

كلاهما جاهز لبيئات الإنتاج، لكنهما يتألقان في سيناريوهات مختلفة. يمتلك LangGraph سجلاً أطول في بيئات الإنتاج — فهو يعمل في شركات مثل Klarna وElastic وReplit منذ عام 2024. وتعد ميزات وضع نقاط التحقق (checkpointing)، واستمرارية الحالة، وتتبعات LangSmith قوية بشكل خاص لمسارات عمل المؤسسات المعقدة. أما ADK فهو أحدث ولكنه مدعوم بالبنية التحتية الإنتاجية لشركة Google؛ وهو الخيار الأكثر أمانًا لعمليات النشر الأصلية على GCP حيث تحتاج إلى ضمانات اتفاقية مستوى الخدمة (SLA) من Vertex AI والامتثال المؤسسي. بالنسبة لغالبية المشاريع الجديدة، نوصي بالبدء بـ LangGraph للأنظمة المعقدة وبـ ADK لأي شيء متكامل مع GCP.

هل يدعم Google ADK التطوير المحلي بدون GCP؟

نعم. يدعم ADK التطوير المحلي مع أي نقطة نهاية نموذج متوافقة مع OpenAI، بما في ذلك نموذج Ollama الذي يعمل محليًا. يمكنك تشغيل الأمر adk web لإطلاق واجهة التطوير القائمة على المتصفح دون الحاجة لاتصال سحابي. تتطلب خدمة بحث Google والأدوات الأخرى من Google مفاتيح API، ولكن يمكنك استبدالها بأدوات مخصصة لا تتطلب ذلك. تتفعل تكاملات GCP (مثل Vertex AI وBigQuery وما إلى ذلك) عندما تقوم بالنشر على Cloud Run أو Vertex AI، ولكنها اختيارية أثناء فترة التطوير.

هل يمكنني الانتقال من LangGraph إلى ADK (أو العكس)؟

نادرًا ما تكون الهجرة بين أطر العمل عملية سلسة تمامًا — فتوقع إعادة كتابة جزئية بدلاً من مجرد نقل مباشر. منطق الوكيل الأساسي (تعريفات الأدوات، الأوامر، قواعد العمل) قابل للنقل، لكن طبقة التنسيق (إدارة الحالة، التوجيه، الاستمرارية) خاصة بكل إطار عمل. النهج العملي: بدلاً من الهجرة الكاملة، فكر في تغليف الوكلاء الحاليين في نقاط نهاية متوافقة مع A2A وبناء وكلاء جدد في إطار العمل المستهدف. يتيح لك هذا الانتقال تدريجيًا دون الحاجة لإعادة كتابة كل شيء مرة واحدة. يدعم كلا إطاري العمل بروتوكول A2A، مما يجعل هذا النهج الهجين عمليًا بشكل متزايد.

🔧 أدوات ذات صلة

🔗 Related Resources on AgDex