A simple conversational voice agent that demonstrates the core Line SDK features.
This example creates a basic voice agent that:
- Has a natural conversation with the user
- Accepts configurable system prompts and introductions via the call request
cd examples/basic_chat
ANTHROPIC_API_KEY=your-key uv run python main.pyThe agent is configured with:
- Model: Anthropic Claude Haiku 4.5
- Config: System prompt and introduction from the call request, with defaults
async def get_agent(env: AgentEnv, call_request: CallRequest):
return LlmAgent(
model="anthropic/claude-haiku-4-5-20251001",
api_key=os.getenv("ANTHROPIC_API_KEY"),
config=LlmConfig(
system_prompt=call_request.agent.system_prompt or "You are a friendly...",
introduction=call_request.agent.introduction or "Hello! I'm your AI assistant...",
),
)VoiceAgentApp: The main application wrapper that handles WebSocket connectionsget_agent: Factory function called for each new call to create an agent instanceLlmConfig: Configuration for the agent's behavior (system prompt, introduction)