Skip to main content

ElevenLabs Moss Integration

Moss delivers sub-10ms semantic retrieval, giving your ElevenLabs Conversational AI agents instant access to a knowledge base during live voice conversations.

Installation

pip install elevenlabs-moss

Prerequisites

  • Moss project ID and project key (get them from Moss Portal)
  • ElevenLabs API key and a Conversational AI agent ID (get them from ElevenLabs)

Usage

import asyncio
import os

from elevenlabs import ElevenLabs
from elevenlabs.conversational_ai.conversation import ClientTools, Conversation
from elevenlabs.conversational_ai.default_audio_interface import DefaultAudioInterface
from elevenlabs_moss import MossClientTool

async def main():
    # Create and load the Moss tool
    moss_tool = MossClientTool(
        project_id=os.getenv("MOSS_PROJECT_ID"),
        project_key=os.getenv("MOSS_PROJECT_KEY"),
        index_name=os.getenv("MOSS_INDEX_NAME"),
    )
    await moss_tool.load_index()

    # Register with ElevenLabs ClientTools
    client_tools = ClientTools()
    moss_tool.register(client_tools)

    # Start the conversation
    conversation = Conversation(
        client=ElevenLabs(api_key=os.getenv("ELEVENLABS_API_KEY")),
        agent_id=os.getenv("ELEVENLABS_AGENT_ID"),
        requires_auth=False,
        audio_interface=DefaultAudioInterface(),
        client_tools=client_tools,
    )
    conversation.start_session()
    await asyncio.to_thread(conversation.wait_for_session_end)

asyncio.run(main())

For a complete voice agent demo, see apps/elevenlabs-moss/.

ElevenLabs Dashboard Setup

Your ElevenLabs agent must have a client tool configured that matches the tool name used in code. In the ElevenLabs dashboard:

  1. Open your agent's settings
  2. Go to Tools and add a new Client tool
  3. Set Tool name to search_knowledge_base (case-sensitive)
  4. Add a parameter: name = query, type = string, required = true
  5. Set the parameter description to: "The user's question to search the knowledge base for"
  6. Enable Wait for response so the tool output is fed back into the conversation

To use a different tool name, pass tool_name="your_name" to MossClientTool and update the dashboard to match.

Configuration Options

MossClientTool

Parameter Default Description
project_id MOSS_PROJECT_ID env var Moss project ID
project_key MOSS_PROJECT_KEY env var Moss project key
index_name (required) Name of the Moss index to query
tool_name search_knowledge_base Tool name (must match ElevenLabs dashboard)
top_k 5 Number of results to retrieve per query
alpha 0.8 Blend: 1.0 = semantic only, 0.0 = keyword only
result_prefix Relevant knowledge base results:\n\n Prefix for formatted results

Methods

Method Description
load_index() Async. Pre-load the Moss index before starting a conversation
search(query) Async. Query Moss and return formatted results as a string
register(client_tools) Register the tool with an ElevenLabs ClientTools instance

License

This integration is provided under the BSD 2-Clause License.

Support

Metadata

Release files for elevenlabs-moss 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for elevenlabs-moss 0.0.1
File Size Uploaded Provenance Actions
elevenlabs_moss-0.0.1.tar.gz 5.5 kB Without provenance Details for elevenlabs_moss-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for elevenlabs-moss 0.0.1
File Interpreter ABI Platform Actions
elevenlabs_moss-0.0.1-py3-none-any.whl Python 3 none any Details for elevenlabs_moss-0.0.1-py3-none-any.whl

Total release size: 11.4 kB

Release files / elevenlabs_moss-0.0.1.tar.gz

Download URL elevenlabs_moss-0.0.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
63a6f6e5009e38b583d9327fa76e4337e4a82519c8d2cec04910b80a76d6832e
BLAKE2b-256 checksum
How to use checksums
fb1e011af1218274dce4d7e2efc1b5e3189575e5716e8f88b43c16d95e891048
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / elevenlabs_moss-0.0.1-py3-none-any.whl

Download URL elevenlabs_moss-0.0.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e13385caa2e929985ec0aff1036eff32a0b76f5016a459be83015035e753d1cb
BLAKE2b-256 checksum
How to use checksums
56fc057013d44df3a2763ee24378111c069ddc51caa1640c1030c432e5ca5ca2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for elevenlabs-moss 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page