ModernPath Agents Framework¶
Build production-grade AI agents with a full-stack TypeScript framework powered by Google Gemini.
ModernPath Agents Framework provides everything you need to go from prototype to production: a backend runtime for orchestrating agents, tools, and knowledge retrieval, paired with drop-in React UI components for chat, tracing, and administration. Deploy to GCP Cloud Functions, Azure Functions, or Cloud Run with a single adapter call.
-
Agents
Extend
BaseAgentwith a structured lifecycle -- validation, execution, timeout, and tracing are handled for you. Ship faster with built-in agents:QAChatAgent,DocumentAnalysisAgent,OrchestratorAgent, andWebResearchAgent. -
Tools
Define tools with the
@Tooldecorator or register them dynamically at runtime. Consume remote tools via MCP (Model Context Protocol) and expose your own tools as MCP servers -- all through a unifiedToolRegistry. -
Knowledge Base
RAG retrieval powered by Gemini File Search Stores. Attach canonical documents for grounding, compose multi-file bundles, and control what reaches the LLM with a declarative grounding policy.
-
Tracing
Full observability out of the box. Every agent execution produces a trace with spans for LLM calls, tool invocations, and retrieval steps. Track token usage and cost with
CostCalculator. Store traces in memory or Firestore. -
Serverless
Deploy anywhere with platform adapters.
gcpHttpwraps your handler for Cloud Functions,azureHttptargets Azure Functions, and streaming SSE handlers work on Cloud Run. One handler, any platform. -
React UI
Drop-in components for agent interfaces:
AgentChatwith streaming support,TraceExplorerfor debugging,KnowledgeBaseManagerfor admin, and hooks likeuseAgentChatfor custom layouts.
Architecture Overview¶
The framework follows a layered architecture. The React UI communicates with a serverless backend over HTTP or Server-Sent Events. The backend handler delegates to an agent, which orchestrates tools, Gemini LLM calls, and knowledge base retrieval. Tracing captures every step.
graph LR
subgraph "Frontend"
UI["React UI<br/><code>@modernpath/agent-ui-react</code>"]
end
subgraph "Serverless Layer"
Handler["Handler Factory<br/><code>createAgentExecuteHandler</code><br/><code>createAgentExecuteStreamHandler</code>"]
Adapter["Platform Adapter<br/><code>gcpHttp</code> | <code>azureHttp</code>"]
end
subgraph "Agent Runtime"
Agent["BaseAgent<br/><code>executeInternal()</code>"]
Tools["ToolRegistry<br/><code>@Tool</code> decorator"]
Gemini["GeminiClient<br/><code>@google/genai</code>"]
KB["Knowledge Base<br/>File Search Stores<br/>Canonical Grounding"]
end
subgraph "Observability"
Tracing["TraceStore<br/>InMemory | Firestore"]
end
UI -- "HTTP / SSE" --> Adapter
Adapter --> Handler
Handler --> Agent
Agent --> Tools
Agent --> Gemini
Agent --> KB
Agent -. "spans & traces" .-> Tracing
UI -. "trace queries" .-> Tracing Packages¶
| Package | Description | Runtime |
|---|---|---|
@modernpath/agent-framework | Backend runtime -- agents, tools, Gemini client, RAG, tracing, serverless handlers | Node.js 20+ |
@modernpath/agent-ui-react | React UI components -- chat, traces, admin, hooks, backend factories | React 18+ |
Both packages are published to GCP Artifact Registry under the @modernpath scope.
Quick Links¶
-
Install the packages and build your first agent in 10 minutes.
-
Deep dive into agents, tools, Gemini integration, and serverless deployment.
-
Explore React components, hooks, and backend factories.
-
Deploy to GCP Cloud Functions, Azure Functions, or Cloud Run.