Recipes← all recipesView on GitHub

Ground a voice AI agent in your documents

AI AgentsRAG for voice AI

Connect a voice AI agent to your documents so it retrieves relevant content before answering.

datasphererag

The claim

Datasphere is SignalWire’s hosted document store: upload PDFs, Word files or Markdown, it chunks and embeds them, and POST /api/datasphere/documents/search returns the passages closest to a query. This agent has one tool, search_docs, which runs that search restricted to the documents tagged for it and hands the passages back as the tool’s response. The retrieval is the platform’s; the boundary is the tag; the code is thirty lines.

Why it holds

What this does not prove: that the model will never answer from its own knowledge. Search evidence cannot enforce a behavioural guarantee; the prompt asks for it and the tool makes it the path of least resistance. Structural constraints on what the model can do are the governance recipes (scope-tools-per-step, require-verification-before-unlocking-tools).

How it works

res = client.datasphere.documents.search(query_string=query, tags=["product-docs"], count=3)
passages = [c["text"] for c in res["chunks"]]
return FunctionResult("Relevant documentation:\n\n" + "\n\n".join(f"- {p}" for p in passages))

The request body (query_string, tags, count, and also distance, language, pos_to_expand, max_synonyms) is the documented Datasphere search API; tags is what scopes the corpus. An empty result returns an explicit “not covered” response rather than nothing, so the model has something truthful to say.

Alternatives with the same shape: the SDK’s datasphere skill (webhook) or datasphere_serverless skill (a DataMap, no server of yours), and native_vector_search for a local .swsearch index with no hosted store.

What to change first

Give two agents two tags over one Datasphere project, a sales corpus and a support corpus, and confirm neither can retrieve the other’s documents.