AGENT HANDOFF

2 Squirrels AI

Technology Stack

Agent-to-Agent (A2A) Protocol implementation demonstrating standardized communication between autonomous AI agents across multiple frameworks including LangGraph, CrewAI, LlamaIndex, and Semantic Kernel.

Protocol A2A (JSON-RPC 2.0)
LLM Google Gemini
Framework LangGraph
Framework CrewAI
Framework LlamaIndex
RAG LlamaParse

Multi-Framework Agent Ecosystem

🔄
LangGraph Agent
ReAct Pattern + Memory
🎨
CrewAI Agent
Image Generation
📄
LlamaIndex Agent
Document RAG
🏠
Host Agent
Task Orchestration
🔌
Semantic Kernel
Plugin Architecture

A2A Protocol: Enables secure, standardized communication between independent agents. Agents treat external entities as untrusted, supporting streaming responses, push notifications, and multi-turn conversations.

Workflow 1: LangGraph Currency Conversion Agent

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
    subgraph Input["📥 CLIENT REQUEST"]
        REQ[/"💱 Currency Query"/]
    end

    subgraph Memory["🧠 STATE MANAGEMENT"]
        CHKPT[("💾 Memory Checkpoint
Multi-turn Context")] end subgraph LLM["🤖 GEMINI REASONING"] PARSE["📝 Parse Request"] CHECK{"🔍 Info Complete?"} end subgraph Conditional["🔀 CONDITIONAL ROUTING"] ASK["❓ Request Clarification
state: input-required"] TOOL["🔧 Invoke Tool"] end subgraph ToolCall["🌐 EXTERNAL API"] FX["💹 Frankfurter API
get_exchange_rate()"] end subgraph Stream["📡 STREAMING"] S1["Looking up rates..."] S2["Processing..."] end subgraph Output["📤 RESPONSE"] RES["✅ Exchange Rate Result
state: completed"] end REQ --> CHKPT CHKPT --> PARSE PARSE --> CHECK CHECK -->|"No"| ASK ASK -->|"User Response"| CHKPT CHECK -->|"Yes"| TOOL TOOL --> FX FX --> S1 S1 --> S2 S2 --> RES

Workflow 2: CrewAI Image Generation Agent

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart LR
    subgraph Input["📥 INPUT"]
        PROMPT["🖼️ Image Prompt"]
        REF[/"📎 Reference Image
(Optional)"/] end subgraph Agent["🤖 CREWAI AGENT"] PARSE["📝 Parse Request"] INIT["🎭 Image Creation Expert"] TASK["📋 Define Task"] end subgraph Tool["🔧 TOOL EXECUTION"] GEN["🎨 Gemini Image API"] RETRY["🔄 Retry Logic"] end subgraph Cache["💾 SESSION CACHE"] STORE[("🗄️ In-Memory Cache
Unique ID")] end subgraph Output["📤 OUTPUT"] B64["📦 Base64 Encode"] ART["🖼️ Image Artifact
+ Cache Reference"] end PROMPT --> PARSE REF --> PARSE PARSE --> INIT INIT --> TASK TASK --> GEN GEN -->|"Failure"| RETRY RETRY --> GEN GEN -->|"Success"| STORE STORE --> B64 B64 --> ART

Workflow 3: LlamaIndex Document RAG Pipeline

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
    subgraph Input["📥 CLIENT MESSAGE"]
        MSG["💬 Query"]
        FILE[/"📎 Document
(PDF, DOCX)"/] end subgraph Parse["📄 DOCUMENT PROCESSING"] STREAM1["📡 Parsing document..."] LLAMA["🦙 LlamaParse
Extract + Line Numbers"] STREAM2["✅ Document parsed"] end subgraph Context["📝 CONTEXT BUILDING"] SYS["🔧 System Prompt
+ Document Context"] HIST[("💬 ChatHistory
Multi-turn Memory")] end subgraph LLM["🤖 LLM QUERY"] GEMINI["🧠 Gemini API
Query + Context"] CITE["📌 Extract Citations"] end subgraph Output["📤 RESPONSE"] MAP["🔗 Map Citation Numbers
to Line Numbers"] ART["📄 Response Artifact
+ Citation Metadata"] end MSG --> Context FILE --> STREAM1 STREAM1 --> LLAMA LLAMA --> STREAM2 STREAM2 --> SYS SYS --> HIST HIST --> GEMINI GEMINI --> CITE CITE --> MAP MAP --> ART ART -->|"Follow-up"| HIST

Workflow 4: Multi-Agent Trip Planner Orchestration

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
    subgraph Input["📥 USER REQUEST"]
        REQ[/"🗺️ Complex Trip Query
Location + Dates + Budget"/] end subgraph Host["🎯 HOST AGENT"] PARSE["📝 Parse Request"] ANALYZE["🔍 Identify Subtasks"] end subgraph Parallel["⚡ PARALLEL A2A CALLS"] subgraph Weather["☁️ WEATHER AGENT"] W_RECV["📨 Receive Query"] W_API["🌤️ Weather API"] W_RES["📤 Conditions"] end subgraph Booking["🏠 AIRBNB AGENT"] B_RECV["📨 Receive Query"] B_MCP["🔌 MCP Airbnb Server"] B_RES["📤 Availability"] end end subgraph Stream["📡 STREAMING"] S1["Checking weather..."] S2["Finding accommodations..."] end subgraph Aggregate["🔗 AGGREGATION"] COLLECT["📥 Collect Responses"] SYNTH["✨ Synthesize Plan"] end subgraph Output["📤 FINAL OUTPUT"] ITIN["📋 Trip Itinerary
Weather + Booking Details"] end REQ --> PARSE PARSE --> ANALYZE ANALYZE --> W_RECV ANALYZE --> B_RECV W_RECV --> W_API W_API --> W_RES B_RECV --> B_MCP B_MCP --> B_RES W_RES --> COLLECT B_RES --> COLLECT ANALYZE --> S1 S1 --> S2 COLLECT --> SYNTH SYNTH --> ITIN

Workflow 5: Multi-Agent Game Loop

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
    subgraph Init["🎮 GAME INIT"]
        ALICE["🎯 Alice Agent
Picks Secret (1-100)"] end subgraph UserTurn["👤 USER TURN (BOB)"] PROMPT["📡 Stream: Enter guess"] GUESS["🔢 Receive Guess"] end subgraph Evaluate["🤔 EVALUATION (ALICE)"] A2A_ALICE["📨 A2A Message/Send"] COMPARE["⚖️ Compare to Secret"] RESULT{"Result?"} end subgraph Visualize["📊 VISUALIZATION (CAROL)"] A2A_CAROL["📨 Request History"] ASCII["🎨 Generate ASCII
Visualization"] SORT["🔄 Reshuffle History"] end subgraph Loop["🔁 GAME LOOP"] SHOW["📺 Display to User"] CHECK{"Correct?"} end subgraph End["🏆 COMPLETE"] WIN["✅ Correct!
Attempts: N"] end ALICE --> PROMPT PROMPT --> GUESS GUESS --> A2A_ALICE A2A_ALICE --> COMPARE COMPARE --> RESULT RESULT -->|"Higher/Lower"| A2A_CAROL A2A_CAROL --> ASCII ASCII --> SORT SORT --> SHOW SHOW --> CHECK CHECK -->|"No"| PROMPT RESULT -->|"Correct"| WIN CHECK -->|"Yes"| WIN

Workflow 6: Semantic Kernel Plugin Architecture

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
    subgraph Input["📥 TRIP REQUEST"]
        REQ[/"🗺️ Trip + Budget Query"/]
    end

    subgraph Manager["🎯 TRAVEL MANAGER AGENT"]
        PARSE["📝 Extract Parameters
Destination, Dates, Budget"] end subgraph Plugins["🔌 PARALLEL PLUGIN AGENTS"] subgraph Currency["💱 CURRENCY AGENT"] C_INV["invoke()"] C_TOOL["🔧 get_exchange_rate"] C_API["💹 Frankfurter API"] C_RES["💵 Converted Budget"] end subgraph Activity["🎯 ACTIVITY AGENT"] A_INV["invoke()"] A_LLM["🧠 LLM Planning"] A_RES["📋 Recommendations"] end end subgraph Stream["📡 STATUS UPDATES"] S1["Analyzing requirements..."] S2["Converting currency..."] S3["Building itinerary..."] S4["Finalizing plan..."] end subgraph Aggregate["🔗 SYNTHESIS"] COLLECT["📥 Aggregate Responses"] COMBINE["✨ Combine Data"] end subgraph Output["📤 TRIP PLAN ARTIFACT"] PLAN["📋 Complete Itinerary
Budget + Activities + Costs"] end REQ --> PARSE PARSE --> C_INV PARSE --> A_INV C_INV --> C_TOOL C_TOOL --> C_API C_API --> C_RES A_INV --> A_LLM A_LLM --> A_RES PARSE --> S1 S1 --> S2 S2 --> S3 S3 --> S4 C_RES --> COLLECT A_RES --> COLLECT COLLECT --> COMBINE COMBINE --> PLAN