Together AI + Klavis AI Integration
In this tutorial, we'll explore how to build an AI agent that integrates Together AI's powerful LLMs with Klavis MCP Servers, enabling seamless interaction with external services and APIs.
This integration combines:
- Together AI: High-performance open-source LLMs with function calling capabilities
- Klavis AI: MCP (Model Context Protocol) servers for connecting to external tools and services
Prerequisites
Before we begin, you'll need:
- Together AI API key - Get yours at together.ai
- Klavis AI API key - Get yours at klavis.ai
Make sure to keep these API keys secure and never commit them to version control!
[notice] A new release of pip is available: 25.0 -> 25.1.1 [notice] To update, run: pip install --upgrade pip
Create AI Agent with MCP Integration
Now we'll create an intelligent agent that uses Together AI's powerful LLMs with Klavis MCP servers. This agent will:
- Discover Tools: Automatically find available tools from MCP servers
- Function Calling: Use Together AI's function calling capabilities
- Tool Execution: Execute tools through Klavis API
- Smart Responses: Generate intelligent responses based on tool results
Use Case 1: Summarize YouTube Video
✅ Created YouTube MCP instance
🤖 Agent initialized with Together AI model: meta-llama/Llama-3.3-70B-Instruct-Turbo
🛠️ Calling tool: get_youtube_video_transcript with args: {'url': 'https://www.youtube.com/watch?v=TG6QOa2JJJQ'}
The YouTube video "Together AI CEO: Open Source Is the Future of AI" features an interview with Vipul Ved Prakash, the CEO of Together AI, and Bucky Moore, a partner at Kleiner Perkins. The discussion revolves around Together AI's $102.5 million Series A fundraise, led by Kleiner Perkins, and the company's focus on open-source AI.
Here is a comprehensive summary of the video with timestamps:
* 0:00 - Introduction to the video and the guests
* 0:30 - Discussion of Together AI's Series A fundraise and the company's mission
* 1:45 - Vipul Ved Prakash explains the importance of open-source AI and how it can benefit the industry
* 3:10 - Bucky Moore shares his perspective on the potential of open-source AI and its applications
* 4:30 - The guests discuss the challenges and opportunities in the AI industry, including the need for more diverse and inclusive data sets
* 5:50 - Vipul Ved Prakash talks about the company's plans for the future and how it aims to make AI more accessible and affordable for everyone
* 6:40 - Conclusion and final thoughts from the guests
Overall, the video provides insights into the future of AI and the potential of open-source AI, as well as the company's plans and goals.
Use Case 2: Send Email
Note: Gmail integration requires OAuth authentication, so you'll need to authorize the application in your browser.
✅ Created Gmail MCP instance 🔐 Opening OAuth authorization for Gmail If you are not redirected automatically, please open this URL: https://api.klavis.ai/oauth/gmail/authorize?instance_id=d9d482b3-433a-4330-9a8b-9548c0b0a326
🤖 Agent initialized with Together AI model: Qwen/Qwen2.5-72B-Instruct-Turbo
🛠️ Calling tool: send_email with args: {'body': 'This is a test email sent using the Together AI and Klavis AI integration. The email was sent automatically by your AI agent!', 'subject': 'Greetings from Together AI + Klavis Integration', 'to': ['zihaolin@klavis.ai']}
The email has been sent successfully to zihaolin@klavis.ai with the subject 'Greetings from Together AI + Klavis Integration'. The email ID is 19776f818ce706db.
🎉 Conclusion
Congratulations! You've successfully built AI agents that integrate Together AI's powerful LLMs with Klavis MCP servers. Here's what we accomplished:
🚀 Next Steps
- Explore More MCP Servers: Try other available servers like Slack, Notion, CRM etc.
- Experiment with Different Models: Test various Together AI models for different use cases.
- Build Complex Multi-Server Workflows: Create sophisticated agents that combine multiple services
- Production Deployment: Scale these patterns for production applications
- Custom MCP Servers: Build your own MCP servers for proprietary systems
🔗 Useful Resources
- Together AI Documentation
- Klavis AI Documentation
- MCP Protocol Specification
- Together AI Models
- Klavis MCP Servers
Happy building with Together AI and Klavis! 🚀