Skip to main content

Prerequisites

Before we begin, you’ll need:

Together AI API Key

Get your API key from Together AI

Klavis AI API Key

Get your API key from Klavis AI

Installation

First, install the required packages:

Setup Environment Variables

Basic Setup

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:
  1. Discover Tools: Automatically find available tools from MCP servers
  2. Function Calling: Use Together AI’s function calling capabilities
  3. Tool Execution: Execute tools through Klavis API
  4. Smart Responses: Generate intelligent responses based on tool results

Use Case Examples

Example 1: Summarize YouTube Video

1

Initialize Clients

Set up Together AI and Klavis API clients
2

Create MCP Instance

Create a YouTube MCP server instance
3

Process Request

Use the agent to analyze and summarize a YouTube video

Example 2: Send Email via Gmail

Gmail integration requires OAuth authentication, so you’ll need to authorize the application in your browser.

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 Multi-Server Workflows

Create sophisticated agents that combine multiple services

Production Deployment

Scale these patterns for production applications

Useful Resources

Happy building with Together AI and Klavis! 🚀