Build AI Agent with SUTRA
This notebook demonstrates how to use SUTRA with Agno (formerly PhiData), a lightweight, model-agnostic framework for building multimodal AI agents. SUTRA-V2, developed by TWO AI, supports multilingual chat and instruction tasks via an OpenAI-compatible API, integrating seamlessly with Agno’s high-performance agent architecture.
🔧 Prerequisites
- Obtain your SUTRA API key from https://developer.two.ai.
- Store the API key securely (e.g., in Google Colab secrets or environment variables).
- Install Agno and OpenAI SDK.
📦 Step 1: Install Dependencies
# SUTRA models are OpenAI API compatible
!pip install -qU agno openai
🔐 Step 2: Initialize SUTRA-V2 with Agno
from agno.agent import Agent
import os
from agno.models.openai.like import OpenAILike
# Set SUTRA API key
api_key = os.getenv("SUTRA_API_KEY")
# Initialize the Agent with Sutra model via OpenAILike wrapper
agent = Agent(
model=OpenAILike(
id="sutra-v2",
api_key=api_key,
base_url="https://api.two.ai/v2"
),
markdown=True,
description="A multilingual assistant powered by SUTRA-V2",
instructions=["Answer concisely in the requested language."],
)
💬 Step 3: Basic Chat Completion
# Run the agent
response = agent.run("Explain AI in three sentences in Hindi.")
print(response.content)
🌟 Why Agno?
- Performance: ~10,000x faster agent creation and ~50x less memory than LangGraph, ideal for lightweight applications.
- Flexibility: Model-agnostic, supports multimodal tasks (text, images, etc.).
- Ease of Use: Minimalist API for rapid prototyping.
🛠 Troubleshooting
- Invalid API Key: Verify your key at https://developer.two.ai.
- Model Not Found: Use
sutra-v2
. SUTRA-V1 was deprecated on March 22, 2025. - Rate Limits: Reduce request frequency or contact TWO AI at https://www.two.ai/support.