Skip to main content
Glama

create_agent

Configure and deploy a conversational AI agent with custom voice, language, and behavior settings for interactive voice applications using ElevenLabs technology.

Instructions

Create a conversational AI agent with custom configuration.

⚠️ COST WARNING: This tool makes an API call to ElevenLabs which may incur costs. Only use when explicitly requested by the user.

Args:
    name: Name of the agent
    first_message: First message the agent will say i.e. "Hi, how can I help you today?"
    system_prompt: System prompt for the agent
    voice_id: ID of the voice to use for the agent
    language: ISO 639-1 language code for the agent
    llm: LLM to use for the agent
    temperature: Temperature for the agent. The lower the temperature, the more deterministic the agent's responses will be. Range is 0 to 1.
    max_tokens: Maximum number of tokens to generate.
    asr_quality: Quality of the ASR. `high` or `low`.
    model_id: ID of the ElevenLabs model to use for the agent.
    optimize_streaming_latency: Optimize streaming latency. Range is 0 to 4.
    stability: Stability for the agent. Range is 0 to 1.
    similarity_boost: Similarity boost for the agent. Range is 0 to 1.
    turn_timeout: Timeout for the agent to respond in seconds. Defaults to 7 seconds.
    max_duration_seconds: Maximum duration of a conversation in seconds. Defaults to 600 seconds (10 minutes).
    record_voice: Whether to record the agent's voice.
    retention_days: Number of days to retain the agent's data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
asr_qualityNohigh
first_messageYes
languageNoen
llmNogemini-2.0-flash-001
max_duration_secondsNo
max_tokensNo
model_idNoeleven_turbo_v2
nameYes
optimize_streaming_latencyNo
record_voiceNo
retention_daysNo
similarity_boostNo
stabilityNo
system_promptYes
temperatureNo
turn_timeoutNo
voice_idNocgSgspJ2msm6clMCkdW9

Implementation Reference

  • Registers the create_agent tool with the MCP framework using the @mcp.tool decorator, defining its description and parameters.
    @mcp.tool(
        description="""Create a conversational AI agent with custom configuration.
    
        ⚠️ COST WARNING: This tool makes an API call to ElevenLabs which may incur costs. Only use when explicitly requested by the user.
    
        Args:
            name: Name of the agent
            first_message: First message the agent will say i.e. "Hi, how can I help you today?"
            system_prompt: System prompt for the agent
            voice_id: ID of the voice to use for the agent
            language: ISO 639-1 language code for the agent
            llm: LLM to use for the agent
            temperature: Temperature for the agent. The lower the temperature, the more deterministic the agent's responses will be. Range is 0 to 1.
            max_tokens: Maximum number of tokens to generate.
            asr_quality: Quality of the ASR. `high` or `low`.
            model_id: ID of the ElevenLabs model to use for the agent.
            optimize_streaming_latency: Optimize streaming latency. Range is 0 to 4.
            stability: Stability for the agent. Range is 0 to 1.
            similarity_boost: Similarity boost for the agent. Range is 0 to 1.
            turn_timeout: Timeout for the agent to respond in seconds. Defaults to 7 seconds.
            max_duration_seconds: Maximum duration of a conversation in seconds. Defaults to 600 seconds (10 minutes).
            record_voice: Whether to record the agent's voice.
            retention_days: Number of days to retain the agent's data.
        """
    )
  • The handler function that executes the create_agent tool logic: builds configs using helpers and calls the ElevenLabs API to create the agent.
    def create_agent(
        name: str,
        first_message: str,
        system_prompt: str,
        voice_id: str | None = DEFAULT_VOICE_ID,
        language: str = "en",
        llm: str = "gemini-2.0-flash-001",
        temperature: float = 0.5,
        max_tokens: int | None = None,
        asr_quality: str = "high",
        model_id: str = "eleven_turbo_v2",
        optimize_streaming_latency: int = 3,
        stability: float = 0.5,
        similarity_boost: float = 0.8,
        turn_timeout: int = 7,
        max_duration_seconds: int = 300,
        record_voice: bool = True,
        retention_days: int = 730,
    ) -> TextContent:
        conversation_config = create_conversation_config(
            language=language,
            system_prompt=system_prompt,
            llm=llm,
            first_message=first_message,
            temperature=temperature,
            max_tokens=max_tokens,
            asr_quality=asr_quality,
            voice_id=voice_id,
            model_id=model_id,
            optimize_streaming_latency=optimize_streaming_latency,
            stability=stability,
            similarity_boost=similarity_boost,
            turn_timeout=turn_timeout,
            max_duration_seconds=max_duration_seconds,
        )
    
        platform_settings = create_platform_settings(
            record_voice=record_voice,
            retention_days=retention_days,
        )
    
        response = client.conversational_ai.agents.create(
            name=name,
            conversation_config=conversation_config,
            platform_settings=platform_settings,
        )
    
        return TextContent(
            type="text",
            text=f"""Agent created successfully: Name: {name}, Agent ID: {response.agent_id}, System Prompt: {system_prompt}, Voice ID: {voice_id or "Default"}, Language: {language}, LLM: {llm}, You can use this agent ID for future interactions with the agent.""",
        )
  • Helper function to create the conversation configuration dictionary required for agent creation.
    def create_conversation_config(
        language: str,
        system_prompt: str,
        llm: str,
        first_message: str | None,
        temperature: float,
        max_tokens: int | None,
        asr_quality: str,
        voice_id: str | None,
        model_id: str,
        optimize_streaming_latency: int,
        stability: float,
        similarity_boost: float,
        turn_timeout: int,
        max_duration_seconds: int,
    ) -> dict:
        return {
            "agent": {
                "language": language,
                "prompt": {
                    "prompt": system_prompt,
                    "llm": llm,
                    "tools": [{"type": "system", "name": "end_call", "description": ""}],
                    "knowledge_base": [],
                    "temperature": temperature,
                    **({"max_tokens": max_tokens} if max_tokens else {}),
                },
                **({"first_message": first_message} if first_message else {}),
                "dynamic_variables": {"dynamic_variable_placeholders": {}},
            },
            "asr": {
                "quality": asr_quality,
                "provider": "elevenlabs",
                "user_input_audio_format": "pcm_16000",
                "keywords": [],
            },
            "tts": {
                **({"voice_id": voice_id} if voice_id else {}),
                "model_id": model_id,
                "agent_output_audio_format": "pcm_16000",
                "optimize_streaming_latency": optimize_streaming_latency,
                "stability": stability,
                "similarity_boost": similarity_boost,
            },
            "turn": {"turn_timeout": turn_timeout},
            "conversation": {
                "max_duration_seconds": max_duration_seconds,
                "client_events": [
                    "audio",
                    "interruption",
                    "user_transcript",
                    "agent_response",
                    "agent_response_correction",
                ],
            },
            "language_presets": {},
            "is_blocked_ivc": False,
            "is_blocked_non_ivc": False,
        }
  • Helper function to create the platform settings dictionary required for agent creation.
    def create_platform_settings(
        record_voice: bool,
        retention_days: int,
    ) -> dict:
        return {
            "widget": {
                "variant": "full",
                "avatar": {"type": "orb", "color_1": "#6DB035", "color_2": "#F5CABB"},
                "feedback_mode": "during",
                "terms_text": '#### Terms and conditions\n\nBy clicking "Agree," and each time I interact with this AI agent, I consent to the recording, storage, and sharing of my communications with third-party service providers, and as described in the Privacy Policy.\nIf you do not wish to have your conversations recorded, please refrain from using this service.',
                "show_avatar_when_collapsed": True,
            },
            "evaluation": {},
            "auth": {"allowlist": []},
            "overrides": {},
            "call_limits": {"agent_concurrency_limit": -1, "daily_limit": 100000},
            "privacy": {
                "record_voice": record_voice,
                "retention_days": retention_days,
                "delete_transcript_and_pii": True,
                "delete_audio": True,
                "apply_to_existing_conversations": False,
            },
            "data_collection": {},
        }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively reveals key behavioral traits: it's a creation/mutation tool (implied by 'Create'), discloses cost implications (API call to ElevenLabs), and provides practical guidance about user requests. It doesn't cover rate limits, authentication needs, or error handling, but offers substantial context beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement upfront, followed by a cost warning, then detailed parameter documentation. While comprehensive, it's appropriately sized for a complex tool with 17 parameters. Every sentence adds value, though the parameter section is lengthy but necessary given the schema coverage gap.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (17 parameters, mutation operation, no annotations, no output schema), the description does an excellent job providing context. It covers purpose, usage warnings, and detailed parameter semantics. The main gap is lack of information about return values or what happens after creation, but this is understandable without an output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage for 17 parameters, the description fully compensates by providing detailed semantic explanations for every parameter. Each parameter gets clear documentation explaining what it represents, including ranges (e.g., 'Range is 0 to 1'), defaults (e.g., 'Defaults to 7 seconds'), and practical meanings (e.g., 'The lower the temperature, the more deterministic the agent's responses will be').

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Create a conversational AI agent with custom configuration.' It specifies the exact action (create) and resource (agent), and distinguishes it from sibling tools like 'get_agent' or 'list_agents' by focusing on creation rather than retrieval.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidance with a cost warning: '⚠️ COST WARNING: This tool makes an API call to ElevenLabs which may incur costs. Only use when explicitly requested by the user.' This gives clear context about when to use it (when explicitly requested) and highlights cost implications. However, it doesn't mention alternatives or when not to use it beyond cost concerns.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/projectservan8n/elevenlabs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server