Inside ItsNotRexed/Leonida: Architecture & Production Teardown: How Does It Work in Production?
TL;DR: The architecture behind the trending ItsNotRexed/Leonida repository relies on the Agent Development Kit (ADK) 2.0 framework to orchestrate production-grade AI agents. It replaces fragile prompt-chaining scripts with deterministic graph workflows, native Agent-to-Agent (A2A) communication protocols, and multi-language support across Python, Go, TypeScript, and Java. Engineering teams adopt this architecture to deploy scalable, observable agentic microservices directly to infrastructure like Cloud Run and GKE rather than relying on opaque managed platforms.
What Is Inside ItsNotRexed/Leonida: Architecture & Production Teardown & Why Is It Blowing Up?
The repository ItsNotRexed/Leonida recently gained traction, accumulating over 2,500 stars on developer leaderboards like Trendshift. Inspection of the underlying architecture detailed in the ItsNotRexed/Leonida README and its release notes reveals a structured implementation built around the Agent Development Kit (ADK) 2.0. Developers are starring this project because it addresses a specific engineering bottleneck. Most AI agent frameworks optimize for local prototyping but fail under concurrent load or lack the observability required for enterprise deployment. This architecture moves beyond prototypes to engineer production agents.
The core engine uses ADK 2.0 to combine deterministic code with adaptive AI reasoning. Instead of relying on a single large language model to guess the next step, the system orchestrates tasks through structured, graph-based architectures. This provides explicit execution paths and predictable outcomes. The framework supports an ecosystem of models, including Gemini, Gemma, Claude, OpenAI, Ollama, vLLM, LiteLLM, and LiteRT-LM. It also provides capabilities for service registration, managed agents, and multi-agent collaborative workflows.
To understand why this architecture is gaining rapid adoption, we must examine how it operates in production. These three field use cases demonstrate its utility.
Real-World Field Use Cases: Where This Moves the Needle in the Field
1. Developer Platform Integration
The Everyday Problem: Engineering teams struggle to integrate AI agents into existing microservice architectures. Most agent frameworks operate as isolated Python scripts that do not fit into standard CI/CD pipelines, lack proper telemetry, and fail to meet enterprise security requirements.
How It Works in Practice: The ADK framework provides native deployment targets for Cloud Run and Google Kubernetes Engine (GKE). Developers use the Agents CLI to scaffold, test, and deploy agents as standard containerized services. The architecture includes built-in observability modules for logging, metrics, and traces.
The Tangible Impact: Platform teams can manage AI agents like traditional microservices. This standardization reduces deployment friction and allows site reliability engineers to monitor agent performance using existing infrastructure dashboards.
2. Concurrency & Memory Footprint
The Everyday Problem: High-throughput applications require low P99 latency. Python-based agent frameworks often suffer from Global Interpreter Lock (GIL) contention and high memory overhead when handling hundreds of concurrent user requests.
How It Works in Practice: The architecture supports multiple languages, including Go (via google.golang.org/adk/v2) and Java/Kotlin. Teams can implement the Agent-to-Agent (A2A) protocol using Go to handle high-concurrency routing and state management. The system uses model context caching and context compression to minimize the payload size sent to inference endpoints.
The Tangible Impact: Rewriting high-traffic routing layers in Go while maintaining the same ADK interface reduces memory consumption and stabilizes P99 latency under heavy load.
3. Build-vs-Buy Adoption Verdict
The Everyday Problem: Organizations face vendor lock-in when building on proprietary managed AI platforms. They lose control over data privacy, model routing logic, and infrastructure costs.
How It Works in Practice: This open-source architecture allows teams to host the Agent Platform internally. The model routing layer abstracts the underlying LLM provider. An engineer can route sensitive data to a locally hosted Ollama or vLLM instance while sending complex reasoning tasks to Claude or Gemini. The framework also supports Model Context Protocol (MCP) tools and OpenAPI integrations for custom internal data access.
The Tangible Impact: Companies maintain sovereignty over their data and infrastructure. They can optimize costs by routing requests to the most cost-effective model based on the task.
Under the Hood: Architecture & Design Choices
The internal architecture of this system departs from linear prompt execution. It relies on a graph-based execution model and a standardized communication protocol for multi-agent orchestration. The design choices prioritize state management, explicit routing, and comprehensive observability. The system components are documented in the Google ADK reference.
flowchart LR
Client([Client Application]) --> Gateway[Apigee AI Gateway]
subgraph Adk_Runtime["ADK Agent Runtime"]
Gateway --> Router{Agent Routing}
Router --> AgentA[LlmAgent: Researcher]
Router --> AgentB[LlmAgent: Coder]
subgraph Graph_Workflow["Graph Workflows"]
AgentA -->|A2A Protocol| AgentB
AgentB -->|State Events| Memory[Context Memory]
end
end
subgraph Tooling["Components & Tools"]
AgentA --> MCP[MCP Tools]
AgentA --> OpenAPI[OpenAPI Tools]
AgentB --> FuncTools[Function Tools]
end
subgraph Model_Layer["Model Routing"]
AgentA --> MRouter{Model Router}
AgentB --> MRouter
MRouter --> Gemini[Gemini / Gemma]
MRouter --> Local[Ollama / vLLM]
MRouter --> External[Claude / OpenAI]
end
Tooling --> ExternalData[(Enterprise Data)]
The execution pipeline begins at the Apigee AI Gateway or a custom API server. Requests enter the ADK Agent Runtime, where the Agent Routing layer determines the workflow. The system supports several patterns. Sequential workflows execute tasks in a strict order. Loop workflows handle iterative refinement. Parallel workflows execute multiple agent tasks concurrently. Custom template workflows allow engineers to define execution graphs tailored to their business logic.
A critical design choice is the implementation of Graph Workflows. This feature combines deterministic code with adaptive AI reasoning. In a standard agent framework, the LLM decides the next tool to call based on the prompt context, which often leads to hallucination loops or skipped steps. The ADK graph workflow enforces explicit execution paths. The LLM operates within the boundaries of a specific graph node. Once the node completes its task, the deterministic graph logic dictates the transition to the next node. This hybrid approach provides predictable outcomes while retaining the flexibility of natural language processing.
The Agent-to-Agent (A2A) Protocol serves as the communication backbone for multi-agent workflows. The architecture defines patterns for exposing and consuming A2A services across Python, Go, and Java. When an agent needs to delegate a sub-task, it does not simply append text to a prompt. It serializes the request, context, and state events into the A2A protocol format. The receiving agent processes the structured payload, executes its graph workflow, and returns a structured response. This protocol enables collaborative workflows where specialized agents operate independently but communicate efficiently.
State management and memory handling are explicit. The architecture includes modules for conversational context, sessions, and state events. Engineers can rewind sessions to debug interaction points or migrate sessions across different backend storage systems. The system implements context compression and model context caching to manage token limits. This prevents the agent from dropping instructions during long-running tasks.
The tooling ecosystem supports function tools, OpenAPI tools, and Model Context Protocol (MCP) tools. MCP integration is an architectural advantage. It allows the agent to act as an MCP server or connect to existing MCP servers to access enterprise data. The framework handles tool performance monitoring, action confirmations, and authentication.
Observability and evaluation are built into the runtime. The system does not rely on external wrappers for telemetry. It generates logging, metrics, and traces for every graph node transition and tool call. The evaluation module provides tools for user and environment simulation. Engineers can define custom metrics to measure agent performance before deploying to Cloud Run or GKE.
Hands-On Quickstart & Code Walkthrough
The framework provides native libraries for multiple languages. Installation requires standard package managers. The Agents CLI also provides scaffolding tools to generate boilerplate code.
For Python environments, install the core package via pip.
pip install google-adk
For Node.js or TypeScript projects, use npm.
npm install @google/adk
For Go implementations, fetch the v2 module.
go get google.golang.org/adk/v2
For Java and Kotlin, include the dependencies in your build system.
com.google.adk:google-adk
com.google.adk:google-adk-kotlin-core
The following code walkthrough demonstrates how to initialize a basic LlmAgent equipped with a Google Search tool. The API design remains consistent across the supported languages, which simplifies cross-team collaboration.
In Python, the Agent class requires a name, a target model, an instruction set, and a list of tools.
from google.adk import Agent
from google.adk.tools import google_search
agent = Agent(
name="researcher",
model="gemini-flash-latest",
instruction="You help users research topics thoroughly.",
tools=[google_search],
)
The TypeScript implementation mirrors this structure using the LlmAgent class.
import { LlmAgent, GOOGLE_SEARCH } from '@google/adk';
const agent = new LlmAgent({
name: 'researcher',
model: 'gemini-flash-latest',
instruction: 'You help users research topics thoroughly.',
tools: [GOOGLE_SEARCH],
});
The Go implementation requires explicit context management and model initialization before constructing the agent struct. This provides tighter control over memory and execution context.
import "google.golang.org/adk/v2/agent/llmagent"
model, _ := gemini.NewModel(context.Background(), "gemini-flash-latest", nil)
a, _ := llmagent.New(llmagent.Config{
Name: "researcher",
Model: model,
Instruction: "You help users research topics thoroughly.",
Tools: []tool.Tool{geminitool.GoogleSearch{}},
})
The Java builder pattern offers a fluent interface for agent configuration.
import com.google.adk.agents.LlmAgent;
import com.google.adk.tools.GoogleSearchTool;
LlmAgent agent = LlmAgent.builder()
.name("researcher")
.model("gemini-flash-latest")
.instruction("You help users research topics thoroughly.")
.tools(new GoogleSearchTool())
.build();
These snippets represent the foundational layer. From this starting point, engineers can wrap the agent in a graph workflow, define A2A exposing interfaces, or deploy the runtime using the agents-cli. The framework handles serialization, tool execution loops, and model API communication.
My Honest Verdict: Where It Fits in Your Stack (Pros & Trade-offs)
Evaluating this architecture requires a look at its capabilities compared to open-source alternatives like LangChain or LlamaIndex. The ADK 2.0 framework works well in enterprise environments that require operational control, but it introduces complexities that teams must consider.
Pros:
- Multi-Language Parity. Most agent frameworks treat non-Python languages as secondary. The ADK provides first-party support for Python, TypeScript, Go, Java, and Kotlin. This allows backend teams to build high-performance agent routing layers in Go while data science teams write evaluation tools in Python.
- Deterministic Graph Workflows. The explicit graph-based architecture prevents unpredictable execution loops common in prompt-chaining systems. Engineers can enforce execution paths, implement retries and timeouts at the node level, and ensure business logic executes deterministically.
- Native MCP and A2A Protocols. Built-in support for the Model Context Protocol and the Agent-to-Agent protocol standardizes how agents interact with external data and each other. This eliminates the need for custom integration glue code for every new internal API.
- Production-Ready Deployment and Observability. The framework is designed for deployment to Cloud Run and GKE. The integration of logging, metrics, traces, and session state management provides the telemetry required to operate agents as reliable microservices.
Trade-offs:
- Architectural Complexity. The shift from simple scripts to graph workflows and A2A protocols has a steep learning curve. Small teams building simple chatbots may find the ADK over-engineered. The boilerplate required to define graph nodes and state events slows down initial prototyping compared to lighter frameworks.
- Ecosystem Lock-In Risks. While the framework supports local models like Ollama and vLLM, the integration with Google Cloud deployment targets (Cloud Run, GKE, Apigee AI Gateway) and specific grounding tools (Google Search Grounding) favors Google's infrastructure. Teams deploying to AWS or Azure will need to implement custom deployment and grounding adapters.
- Protocol Overhead. The A2A protocol adds serialization and network overhead to multi-agent communication. In scenarios where agents could share memory within a single process, forcing communication through the A2A layer increases latency and resource consumption.
This architecture fits best in organizations that have moved past the AI prototyping phase and need to integrate agents into high-throughput microservice ecosystems. It provides the structure to build reliable, observable, and scalable AI systems. Teams that require control over execution paths, multi-language support, and enterprise-grade observability will find the ADK 2.0 framework effective. Those looking for a quick way to wrap a single LLM prompt in a web interface should evaluate simpler alternatives before committing to this level of architectural rigor.