π Agent SDK Overview
The STELLA Agent SDK lets you build custom voice agents without rebuilding infrastructure. Focus on your agent's logicβSTELLA handles everything else.
Why Use the Agent SDK?β
| STELLA Handles | You Build |
|---|---|
| Audio pipeline (STT β TTS) | Conversation logic |
| WebRTC streaming | Custom tools |
| Session lifecycle | Business rules |
| Deployment & scaling | Prompts & workflows |
The result: Deploy production-ready voice agents in hours, not weeks. No infrastructure maintenance, no audio engineeringβjust your agent logic.
What is the Agent SDK?β
The Agent SDK is a Python framework that provides:
- LiveKit Integration: Connect to rooms, publish/subscribe audio
- Audio Pipeline: STT, LLM, and TTS orchestration
- Message Protocol: Structured data channel communication
- Progress Tracking: Todo lists and status updates
- Tool Execution: Custom function/tool support
- Chat History: Access conversation transcripts for context building
Architectureβ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Your Custom Agent β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Business Logic β β
β β (Custom handlers, tools, prompts) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Agent SDK β β
β β ββββββββββββ ββββββββββββ ββββββββββββ β β
β β β BaseAgentβ β Audio β β Message β β β
β β β β β Pipeline β β Protocol β β β
β β ββββββββββββ ββββββββββββ ββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β LiveKit Client β β
β β (Audio tracks, Data channels, RTC) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Key Componentsβ
BaseAgentβ
The foundation class that all agents extend:
from stella_sdk import BaseAgent
class MyAgent(BaseAgent):
async def on_message(self, message):
# Handle incoming messages
pass
async def on_audio(self, audio_data):
# Handle incoming audio
pass
Audio Pipelineβ
Manages the STT β LLM β TTS flow:
from stella_sdk import AudioPipeline, STTProvider, TTSProvider
pipeline = AudioPipeline(
stt=STTProvider.SHERPA,
tts=TTSProvider.KOKORO
)
Message Typesβ
Structured messages for data channel communication:
from stella_sdk import TranscriptMessage, StatusMessage
# Send transcript update
await agent.send(TranscriptMessage(
text="Hello!",
is_final=True
))
# Send status update
await agent.send(StatusMessage(
status="thinking"
))
Toolsβ
Custom functions the agent can call:
from stella_sdk import Tool
@tool
async def search_database(query: str) -> str:
"""Search the database for information."""
results = await db.search(query)
return results
Chat Historyβ
Access conversation transcripts for context building. STELLA automatically records all session messagesβyour agent can retrieve them without any setup:
# Get recent conversation history
history = await self.get_chat_history(limit=20)
# Use for LLM context
for msg in history:
print(f"{msg.role}: {msg.content}")
See Accessing Chat History for the full API.
Quick Exampleβ
from stella_sdk import BaseAgent, AudioPipeline
class SimpleAgent(BaseAgent):
def __init__(self):
super().__init__()
self.pipeline = AudioPipeline()
async def on_connect(self):
await self.send_status("ready")
async def on_transcript(self, text: str, is_final: bool):
if is_final:
response = await self.generate_response(text)
await self.speak(response)
async def generate_response(self, user_input: str) -> str:
# Your LLM logic here
return f"You said: {user_input}"
# Run the agent
if __name__ == "__main__":
agent = SimpleAgent()
agent.run()
Installationβ
pip install stella-agent-sdk
Or add to your requirements.txt:
stella-agent-sdk>=1.0.0
Next Stepsβ
- Getting Started - Create your first custom agent
- Base Agent - Deep dive into the BaseAgent class
- Message Types - All available message types
- Audio Pipeline - Configure STT/TTS providers
- Building Custom Agents - Complete tutorial