A modern, high-performance chat application demonstrating the integration of Google Agent Development Kit (ADK) with Next.js 16, AI SDK, and custom utilities.
Includes an llms.txt file for enhanced discoverability and documentation for AI-assisted development.
- Advanced AI Agents: Built with
@google/adk, featuring custom tools and multi-model support. - Enhanced Model Support: Utilizes
@yagolopez/adk-utilsto provide seamless integration with Ollama models within the ADK ecosystem.- Usage: See
app/agents/agent1.tswhere it's used to instantiate theOllamaModelfor local LLM execution.
- Usage: See
- Modern Chat UI: A responsive, premium chat interface with:
- Streaming responses.
- Markdown rendering (syntax highlighting, tables, etc.).
- Mermaid.js diagrams support for visual representations.
- Interactive suggestions and empty state.
- Smart Components:
- Rate Limiting: Integrated using
@tanstack/react-pacerto protect resources. - Auto-scroll: Efficient message list scrolling.
- Typing Indicators: Real-time feedback during AI generation.
- Rate Limiting: Integrated using
- Tool Integration:
get_current_time: Retrieves time for any city worldwide.create_mermaid_diagram: Generates visual flowcharts, sequence diagrams, and more.
- Optimized for DX:
- Tailwind CSS 4 for state-of-the-art styling.
- ESLint and Prettier for code consistency.
- Jest for unit testing.
- Framework: Next.js 16 (App Router, React 19)
- AI Core:
- Styling: Tailwind CSS 4
- State Management: React Hooks + TanStack Pacer
- Icons: Lucide React
- Formatting/Diagrams: Streamdown
- Node.js 18+
- npm / pnpm / yarn
-
Clone the repository:
git clone https://github.com/YagoLopez/adk-utils-example.git cd adk-utils-example -
Install dependencies:
npm install
-
Set up environment variables: Create a
.envfile in the root and add your configuration (e.g., API keys for Gemini or Ollama endpoints).
-
Development Server:
npm run dev
Open http://localhost:3000 to start chatting.
-
ADK Web Tool: Launch the ADK web explorer to inspect your agents:
npm run adk:web
The following diagram illustrates how a user message is processed through the system:
sequenceDiagram
participant U as User (Browser)
participant R as API Route (/api/genai-agent)
participant S as GenAIAgentService (@yagolopez/adk-utils)
participant A as rootAgent (ADK)
participant T as Tools (Time / Mermaid)
U->>R: POST /api/genai-agent (messages)
R->>S: Initialize with rootAgent
R->>S: service.createStreamingResponse(messages)
S->>A: Process request
activate A
Note over A: Decision: Does it need a tool?
A->>T: Call tool (if needed)
T-->>A: Tool result
A-->>S: Generated tokens / Tool responses
deactivate A
S-->>R: Stream Response
R-->>U: AI Stream (SSE)
/app: Next.js app router pages and API routes./app/agents: Definition of ADK agents and tools./app/api/genai-agent: Backend route for agent communication.
/components: Reusable UI components (ChatHeader, ChatInput, ChatMessage, etc.)./hooks: Custom React hooks (e.g.,useScrollToBottom)./lib: Shared utility functions.
Run unit tests with Jest:
npm test- Support for agent/model selection from the UI.
- Automatic tool response detection in the UI.
This project is licensed under the MIT License.