Skip to main content
Build an agent, deploy it, and make your first call within minutes.

Prerequisites

  • A free Cartesia account (sign up here)
  • Python 3.9+
  • An LLM API key (Anthropic, OpenAI, Google, etc.)
  • uv (Python package and project manager)

Install the CLI

curl -fsSL https://cartesia.sh | sh
cartesia auth login

Install uv

Install uv, a fast Python package manager to manage dependencies and virtual environments.
curl -LsSf https://astral.sh/uv/install.sh | sh

Create your agent

Create a new project and install dependencies. uv will automatically set up a virtual environment and manage your packages.
uv init my-voice-agent && cd my-voice-agent
uv add cartesia-line
Create main.py:
import os
from line.llm_agent import LlmAgent, LlmConfig, end_call
from line.voice_agent_app import VoiceAgentApp

async def get_agent(env, call_request):
    return LlmAgent(
        model="anthropic/claude-haiku-4-5-20251001", # Or "gpt-5-nano", "gemini/gemini-2.5-flash", etc.
        api_key=os.getenv("ANTHROPIC_API_KEY"),
        tools=[end_call],
        config=LlmConfig(
            system_prompt="You are a helpful assistant.",
            introduction="Hello! How can I help you today?",
        ),
    )

app = VoiceAgentApp(get_agent=get_agent)

if __name__ == "__main__":
    app.run()

Test locally

Start your agent server.
ANTHROPIC_API_KEY=your-api-key PORT=8000 uv run python main.py
In a separate terminal, chat with your agent by simply running:
cartesia chat 8000
This lets you test your agent’s reasoning before deploying.

Deploy

Link your project and deploy.
cartesia init    # Choose "Create new" and name your agent
cartesia deploy
Your agent deploys in under 30 seconds on Cartesia’s managed runtime.

Set environment variables

Configure your API key for the deployed agent.
cartesia env set ANTHROPIC_API_KEY=your-api-key
Or import from a .env file:
cartesia env set --from .env

Make a call

Call your agent from your phone.
cartesia call +1XXXXXXXXXX
Or visit the Playground to call from the web.

Next steps