Building AI-powered applications can be daunting. Between choosing the right models, setting up infrastructure, and handling API integrations, developers often spend more time on setup than on building their actual product. That's where the Gaia Agent Starter Kit comes in—a streamlined foundation that gets you from idea to working AI application in minutes, not hours.
Why Another AI Starter Kit?
The AI development landscape is cluttered with complex frameworks and heavyweight solutions. Most require extensive configuration, vendor lock-in, or compromise on performance and privacy. Gaia's approach is different:
- Decentralized by design - No single point of failure or vendor dependency
- Privacy-focused - Your data stays where you want it
- Developer-friendly - Clean APIs and straightforward integration
- Production-ready - Built on proven infrastructure
This starter kit distills years of AI application development experience into a simple, extensible foundation.
The Starter Kit Architecture
The Gaia Agent Starter Kit follows a clean, modular architecture built on Next.js:
Core Components
Frontend Layer: A clean React interface with streaming chat capabilities
API Integration: Streamlined connection to Gaia's AI infrastructure
Tool System: Extensible framework for adding custom AI capabilities
Configuration Management: Simple environment-based setup
Quick Start: From Clone to Chat in 5 Minutes
Step 1: Project Setup
git clone https://github.com/meowyx/gaia-agent-starter
cd gaia-agent-starter
pnpm install
The project uses pnpm for faster dependency installation, but works with npm or yarn as well.
Step 2: Get Your Gaia API Credentials
The setup process is straightforward:
- Visit gaianet.ai and click Launch App
- Connect your wallet - MetaMask or other Web3 wallets work
- Access settings via the profile dropdown
- Create an API key in the "Gaia API Keys" section
- Choose your base URL from available public nodes
Step 3: Environment Configuration
Create your .env.local
file:
NEXT_PUBLIC_GAIA_API_BASE_URL=
NEXT_PUBLIC_GAIA_API_KEY=your_api_key_here
Step 4: Launch Your AI Agent
pnpm dev
Open http://localhost:3000 and start chatting with your AI agent.
Under the Hood: How It Works
API Route Implementation
The core API route demonstrates clean integration with Gaia:
import { createOpenAI } from "@ai-sdk/openai";
import { streamText } from "ai";
import { tools } from "@/ai/tools";
export async function POST(request: Request) {
const { messages } = await request.json();
const openai = createOpenAI({
baseURL: process.env.NEXT_PUBLIC_GAIA_API_BASE_URL,
apiKey: process.env.NEXT_PUBLIC_GAIA_API_KEY
});
try {
const result = streamText({
model: openai("llama"),
system: "you are a friendly assistant",
messages,
maxSteps: 5,
tools,
});
return result.toDataStreamResponse();
} catch (error) {
console.error(error);
return new Response("Internal server error", { status: 500 });
}
}
This approach provides:
- Environment-based configuration - No hardcoded values
- Error handling - Graceful failure management
- Streaming responses - Real-time conversation flow
- Tool integration - Extensible AI capabilities
Frontend Integration
The frontend uses a clean, welcoming interface:
export default function Home() {
return (
<div
className="h-screen w-full overflow-y-auto grid grid-rows-[20px_1fr_60px]"
style={{
background: "linear-gradient(135deg, #fcf8e8 0%, #d4e2d4 100%)",
}}
>
<main className="gap-8 row-start-2 sm:items-start h-full w-full">
<div className="flex flex-col gap-3 items-center justify-center h-full">
<div className="text-center mb-6">
<h1 className="text-3xl font-bold mb-2 text-green-800">
Hi there, Let's Chat 👋
</h1>
<p className="text-sm text-green-600 italic">
powered by <Link href="https://www.gaianet.ai/">gaia</Link> 🌱
</p>
</div>
<Chat />
</div>
</main>
</div>
);
}
The design emphasizes:
- Approachable aesthetics - Warm, natural color scheme
- Clear branding - Gaia attribution and links
- Responsive layout - Works across all device sizes
- Accessibility - Proper semantic structure
Customization and Extension
Adding Custom Tools
The starter kit includes a tools system for extending AI capabilities:
// ai/tools.ts
export const tools = {
getCurrentTime: {
description: 'Get the current time',
parameters: z.object({}),
execute: async () => {
return new Date().toISOString();
},
},
// Add your custom tools here
calculateTip: {
description: 'Calculate tip amount',
parameters: z.object({
amount: z.number(),
percentage: z.number()
}),
execute: async ({ amount, percentage }) => {
return amount * (percentage / 100);
},
}
};
Customizing the AI Personality
Modify the system prompt to change your agent's behavior:
const result = streamText({
model: openai("llama"),
system: `You are a specialized assistant for [your domain].
You should:
- Be helpful and accurate
- Focus on [your specific area]
- Provide actionable advice
- Ask clarifying questions when needed`,
messages,
maxSteps: 5,
tools,
});
Styling and Branding
The starter kit uses Tailwind CSS for easy customization:
/* Custom color scheme */
:root {
--primary-green: #16a34a;
--accent-green: #22c55e;
--background-start: #fcf8e8;
--background-end: #d4e2d4;
}
Production Deployment
Environment Configuration
For production deployment, ensure your environment variables are properly set:
# Production environment
NEXT_PUBLIC_GAIA_API_BASE_URL=
NEXT_PUBLIC_GAIA_API_KEY=your_production_api_key
Performance Optimizations
The starter kit includes several built-in optimizations:
- Automatic code splitting - Next.js handles this automatically
- Image optimization - Built-in Next.js image optimization
- Streaming responses - Reduces perceived latency
- Error boundaries - Graceful error handling
Security Considerations
While the starter kit is secure by default, consider these additional measures for production:
// Add rate limiting
import { rateLimit } from '@/lib/rate-limit';
export async function POST(request: Request) {
const identifier = request.headers.get('x-forwarded-for') || 'localhost';
const { success } = await rateLimit.limit(identifier);
if (!success) {
return new Response('Too many requests', { status: 429 });
}
// ... rest of your handler
}
Common Use Cases and Extensions
Customer Support Agent
Transform the starter into a support agent:
const supportSystem = `You are a customer support agent for [Company Name].
You have access to:
- Product documentation
- Order lookup tools
- Troubleshooting guides
Always be helpful, patient, and professional.`;
Educational Tutor
Create a specialized learning assistant:
const tutorSystem = `You are an educational tutor specializing in [Subject].
You should:
- Break down complex concepts
- Provide examples and practice problems
- Adapt to the student's level
- Encourage learning`;
Developer Assistant
Build a coding companion:
const devSystem = `You are a senior developer assistant.
You can help with:
- Code review and suggestions
- Debugging assistance
- Architecture recommendations
- Best practices guidance`;
Connecting to Your Own Gaia Node
For maximum control and privacy, you can run your own Gaia node:
Local Node Setup
# Install Gaia node
curl -sSfL 'https://github.com/GaiaNet-AI/gaianet-node/releases/latest/download/install.sh' | bash
# Initialize with your preferred model
gaianet init --config https://raw.githubusercontent.com/GaiaNet-AI/node-configs/main/llama-3-groq-8b-tool/config.json
# Start your node
gaianet start
Configuration Update
Update your environment variables to point to your local node:
NEXT_PUBLIC_GAIA_API_BASE_URL=http://localhost:8080/v1
NEXT_PUBLIC_GAIA_API_KEY="" # Can be empty for local nodes
Troubleshooting Common Issues
API Connection Problems
If you're having trouble connecting to Gaia:
-
Verify your API key - Ensure it's correctly set in
.env.local
- Check the base URL - Confirm the node is accessible
- Review network settings - Firewall or proxy issues
- Check rate limits - Some nodes have usage restrictions
Streaming Response Issues
If messages aren't streaming properly:
- Browser compatibility - Ensure modern browser support
- Network configuration - Some proxies block streaming
- Error handling - Check browser console for errors
Tool Integration Problems
If custom tools aren't working:
- Parameter validation - Ensure Zod schemas are correct
- Async handling - All tool functions should be async
- Error boundaries - Add proper error handling
Advanced Patterns
Multi-Agent Conversations
Extend the starter to support multiple AI agents:
const agents = {
researcher: {
system: "You are a research specialist...",
model: "llama"
},
writer: {
system: "You are a creative writer...",
model: "llama"
}
};
// Route to different agents based on context
const selectedAgent = agents[agentType];
Context Persistence
Add conversation memory:
// Store conversation context
const conversation = {
id: generateId(),
messages: [],
context: {},
created: new Date()
};
// Retrieve and maintain context across sessions
Integration with External APIs
Add external data sources:
const tools = {
getWeather: {
description: 'Get current weather',
parameters: z.object({
location: z.string()
}),
execute: async ({ location }) => {
const response = await fetch(`https://api.weather.com/${location}`);
return await response.json();
}
}
};
Community and Ecosystem
The Gaia Agent Starter Kit is part of a growing ecosystem:
Community Resources
- GitHub Discussions - Share experiences and get help
- Discord Community - Real-time chat with other developers
- Documentation - Comprehensive guides and tutorials
- Example Projects - Inspiration and code samples
Contributing Back
Ways to contribute to the ecosystem:
- Share your extensions - Tools, UI components, integrations
- Submit bug reports - Help improve stability
- Write tutorials - Help others learn
- Contribute code - Direct improvements to the starter kit
The Future of AI Development
This starter kit represents a philosophy shift in AI development:
From Complexity to Simplicity
Instead of overwhelming developers with options, provide a clean foundation they can build upon.
From Centralized to Decentralized
Remove single points of failure and give developers control over their AI infrastructure.
From Proprietary to Open
Open-source tools and transparent infrastructure enable innovation and trust.
Conclusion: Getting started with your AI Agent Journey
The Gaia Agent Starter Kit removes the friction from AI application development. Whether you're building a customer service bot, an educational tutor, or a specialized domain assistant, this foundation gives you everything you need to start building immediately.
The real power comes from what you build on top of it. The starter kit is intentionally minimal—a clean canvas for your ideas rather than a prescriptive framework. This approach enables rapid prototyping while maintaining the flexibility to scale and customize as your application grows.
Ready to build your first AI agent? Clone the repository, follow the setup guide, and start experimenting.
Getting Started:
Top comments (0)