Overview
Toots uses Google’s Gemini AI model to power intelligent features:- Ticket generation - Analyze project descriptions and generate actionable tickets
- Project chat - Interactive assistant that asks clarifying questions
- Smart recommendations - Priority, effort, and dependency suggestions
Getting a Gemini API key
- Visit Google AI Studio
- Sign in with your Google account
- Click “Get API key” or “Create API key”
- Copy your API key
Configuration
Add your Gemini API key toapps/web/.env:
apps/web/.env
AI model
Toots uses thegemini-2.5-flash model:
- Fast response times
- High-quality text generation
- Tool calling and function execution
- Structured output support
AI features
Ticket generation
The AI generates structured tickets based on project descriptions:Project chat assistant
The AI chat assistant helps refine project scope:-
Clarifying questions - Asks 2-4 targeted questions about:
- Goals and success criteria
- Stakeholders and audience
- Key deliverables and milestones
- Timeline and constraints
- Dependencies
- Context gathering - Remembers conversation history and project details
- Ticket refinement - Add, update, or remove tickets based on feedback
AI tools
The chat assistant has access to several tools:generateTickets- Create new tickets for the projectlistTickets- Retrieve existing ticketsupdateTickets- Modify ticket propertiesremoveTickets- Delete tickets by IDsetClarifyingQuestions- Present structured questions to users
Implementation details
Vercel AI SDK
Toots uses the Vercel AI SDK for AI integration:- Streaming responses - Real-time token streaming
- Tool calling - Execute functions from AI responses
- Message history - Maintain conversation context
- UI components - React hooks for chat interfaces
API endpoint
AI chat is handled by the/api/chat route:
apps/web/app/api/chat/route.ts
System prompts
The AI uses different prompts based on context: Initial project creation:- Analyzes new project ideas
- Asks clarifying questions
- Generates initial tickets
- References existing project context
- Avoids asking user to re-describe the project
- Focuses on refinement and iteration
The system prompts are designed to handle various project types (product launches, marketing campaigns, events, process changes) not just software projects.
Usage limits and pricing
Gemini API has usage limits and pricing:- Free tier - 60 requests per minute
- Rate limits - May vary by region and model
- Pricing - Check Google AI pricing for current rates
Error handling
Toots handles AI errors gracefully:Missing API key
If the API key is not configured:API failures
If the Gemini API fails:- Error messages are logged to the console
- Users see a friendly error message
- Chat history is preserved
Testing AI features
Development workflow
- Set your API key in
.env - Start the development server:
pnpm dev - Create a new project or open an existing one
- Test the chat assistant:
- Ask questions
- Request ticket generation
- Try updating and removing tickets
Example prompts
Initial project:Production considerations
API key security
- Store API keys in environment variables
- Use different keys for staging and production
- Rotate keys periodically
- Never log or expose keys in client-side code
Rate limiting
Implement rate limiting to prevent abuse:- Limit requests per user
- Add request queuing
- Implement exponential backoff for retries
Monitoring
Track AI performance metrics:- Response times
- Error rates
- Token usage
- User satisfaction
Future AI features
Planned enhancements:- Insight extraction - Analyze customer feedback and interviews
- Evidence-based recommendations - Suggest features backed by data
- Semantic search - Find relevant information using embeddings
- Multi-source synthesis - Combine insights from multiple data sources
See the product discovery roadmap for details on upcoming AI features.
Troubleshooting
API key invalid
If you see authentication errors:- Verify your API key is correct
- Check the key hasn’t been revoked
- Ensure you’re using a valid Google account
Slow responses
If AI responses are slow:- Check your internet connection
- Verify you’re not hitting rate limits
- Consider using a different model or parameters
Unexpected outputs
If the AI generates unexpected content:- Review your system prompts
- Check conversation history for context issues
- Add more specific instructions or constraints
Next steps
After setting up AI integration:- Start the development server
- Create your first project and test ticket generation
- Explore the project chat assistant
- Review generated tickets on the Kanban board