import os# Set environment variablesos.environ["FIREWORKS_API_KEY"] = "your-fireworks-api-key-here" # Replace with your actual Fireworks API keyos.environ["KLAVIS_API_KEY"] = "your-klavis-api-key-here" # Replace with your actual Klavis API key
Use the agent to analyze and summarize a YouTube video
Copy
Ask AI
YOUTUBE_VIDEO_URL = "https://www.youtube.com/watch?v=kPXvf2-C_Hs" # Pick a video you like!# 1. Create YouTube MCP server instanceyoutube_mcp_instance = klavis_client.mcp_server.create_server_instance( server_name=McpServerName.YOUTUBE, user_id="1234", platform_name="Klavis",)# 2. Create an agent with YouTube MCP serveragent = Agent(fireworks_client, klavis_client, youtube_mcp_instance.server_url)# 3. Process the requestresponse = agent.process_request( f"Summarize this YouTube video with timestamps: {YOUTUBE_VIDEO_URL}")print(response)
Gmail integration requires OAuth authentication, so you’ll need to authorize the application in your browser.
1
Create Gmail Instance
Create a Gmail MCP server instance
2
OAuth Authorization
Complete OAuth flow for Gmail access
3
Send Email
Use the agent to send an email
Copy
Ask AI
import webbrowser# Create Gmail MCP server instancegmail_mcp_instance = klavis_client.mcp_server.create_server_instance( server_name=McpServerName.GMAIL, user_id="1234", platform_name="Klavis",)# Redirect to Gmail OAuth pagewebbrowser.open(gmail_mcp_instance.oauth_url)print(f"🔐 Opening OAuth authorization for Gmail, if you are not redirected, please open the following URL in your browser: {gmail_mcp_instance.oauth_url}")EMAIL_SUBJECT = "Hello, World!"EMAIL_BODY = "This is a test email sent using Fireworks AI and Klavis integration."EMAIL_RECIPIENT = "recipient@example.com" # Replace with your email# After OAuth authorization, create an agent with Gmail MCP serveragent = Agent(fireworks_client, klavis_client, gmail_mcp_instance.server_url)# Send the emailresponse = agent.process_request( f"Send an email to {EMAIL_RECIPIENT} with subject {EMAIL_SUBJECT} and body {EMAIL_BODY}")print(response)