Skip to main content
Integrate Moss semantic search into a VAPI voice agent using the vapi-moss package. VAPI sends knowledge-base requests to your endpoint, where Moss searches a loaded index and returns documents for the assistant to use.
Note: See the vapi-moss app source for an endpoint example. Match its assistant configuration and authentication to the current VAPI contract below; this guide does not establish a tested end-to-end voice call.

Why use Moss with VAPI?

Moss runs retrieval in your webhook application’s process after the index is loaded. VAPI requests knowledge-base information when the assistant needs it; retrieval is not guaranteed on every user turn. Network time, model generation and audio processing also affect the complete voice response.

Required tools

  • Moss account with project credentials
  • VAPI account with a Conversational AI agent
  • Python 3.10+

Integration guide

1

Installation

2

Environment setup

Create a .env file in your project root with your credentials.
.env
3

Load and search your index

Use MossVapiSearch in your asynchronous application. Load the index at server startup, then call search() from the authenticated request handler. The snippet below shows retrieval, not a complete HTTP server or voice call.
4

Implement and authenticate the endpoint

Expose a public HTTPS POST endpoint that handles message.type: "knowledge-base-request". Extract the query from the conversation messages, authenticate the request, then use search() to retrieve documents. Return a JSON object containing a documents array:
This is a response-format illustration, not an observed search result. If you include uuid, it must be a UUID v4; omit it when your source IDs use another format. See VAPI’s custom endpoint contract.Create a VAPI Custom Credential for the endpoint and make your server validate the selected authentication method before retrieval. For example, a Bearer Token credential can send Authorization: Bearer <token>. HMAC credentials require validation of their configured signing header, algorithm and payload format; setting a secret alone does not establish that format.
5

Configure the assistant through the VAPI API

Set model.knowledgeBase in the assistant API to a custom knowledge base with your server URL and credential ID. The following object is the value of model.knowledgeBase, not a complete assistant update:
Preserve the existing model configuration, including its provider, model, messages and tools, when updating the assistant. Use the current embedded model.knowledgeBase configuration; the standalone /knowledge-base endpoint and model.knowledgeBaseId were removed in VAPI’s September 2025 API cleanup.

Configuration

MossVapiSearch

Optional raw-body HMAC helper

vapi-moss also exports verify_vapi_signature(raw_body, signature_header, secret). This helper checks a SHA-256 HMAC over the raw request body against a hexadecimal signature, with an optional sha256= prefix. Use it only when the VAPI HMAC credential is configured to produce that exact format and your endpoint reads its configured signature header. The helper does not validate Bearer tokens or a timestamp-based signing format. For other credential settings, implement the matching validator from VAPI’s authentication guidance. Do not assume all VAPI knowledge-base requests carry a fixed x-vapi-signature header.