A newer version of the Gradio SDK is available: 6.14.0
Graph Structure
Overview
This document describes the LangGraph structure for the agent system.
Graph Flow
START → Agent Node → [Tool Node] → Agent Node → END
↓
END
The agent can either:
- Respond directly and end
- Call tools, process results, and then respond
Node Descriptions
Agent Node
- Purpose: Process user input and generate responses
- Input: User message and conversation history
- Output: Agent response or tool calls
- Logic:
- Receive user input
- Load agent definition from markdown
- Apply system prompt and behavior guidelines
- Generate response using LLM with tool access
- Either return response or request tool execution
Tool Node
- Purpose: Execute tools requested by the agent
- Input: Tool calls from agent
- Output: Tool execution results
- Available Tools:
summarize_text: Summarizes long text into concise summaries
State Schema
The graph maintains the following state:
{
"messages": List[BaseMessage], # Conversation history
"agent_name": str, # Name of the active agent
"metadata": dict # Additional context/metadata
}
Conditional Edges
should_continue
Routes the flow based on agent's decision:
- To "tools": If agent requests tool execution
- To "end": If agent provides final response
This enables the agent to:
- Use tools when needed for tasks like summarization
- Respond directly for simple queries
- Chain multiple tool calls if necessary
Checkpointing
The graph supports checkpointing for:
- Conversation persistence
- State recovery
- Debugging and replay
Extension Points
To extend this graph:
- Add new nodes for additional processing steps
- Implement conditional edges for routing logic
- Add tool nodes for external integrations
- Create sub-graphs for complex workflows