Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Basic Chat Example

A simple conversational voice agent that demonstrates the core Line SDK features.

Overview

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

Running the Example

cd examples/basic_chat
ANTHROPIC_API_KEY=your-key uv run python main.py

How It Works

The 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...",
        ),
    )

Key Concepts

  • VoiceAgentApp: The main application wrapper that handles WebSocket connections
  • get_agent: Factory function called for each new call to create an agent instance
  • LlmConfig: Configuration for the agent's behavior (system prompt, introduction)