Repository navigation
feat: add moss knowledge retrieval extension and example - #2351
rafaelbeckel wants to merge 1 commit into
Conversation
Add moss_tool_python, a search_knowledge_base tool that searches a Moss index loaded in memory, and voice-assistant-with-moss, which runs it in two graphs: ambient retrieval through a context_tool property on main_control, and a plain LLM tool call.
|
Findings
Checks
|
Summary
Adds Moss knowledge retrieval to TEN in two parts:
moss_tool_python: asearch_knowledge_basetool for any TEN graph. It loads a Moss index into memory when the agent starts and runs hybrid (semantic and keyword) search locally, so a search takes a few milliseconds and makes no network request.examples/voice-assistant-with-moss: the voice-assistant example with two graphs.moss_ambientsearches on every final user turn and adds the passages to that turn, so the LLM answers in one call.moss_toollets the LLM call the tool when it needs to. Ambient retrieval is acontext_toolproperty onmain_control(about 20 lines); the rest of the example is copied from voice-assistant.Why
Architecture and configuration
Both modes, with diagrams, are in the example README. The node settings (project, key, index,
top_k) are in the extension README. Credentials come fromMOSS_PROJECT_ID,MOSS_PROJECT_KEYandMOSS_INDEX_NAME, added to.env.example.Dependency
moss>=1.15.0from PyPI, which adds one native wheel (inferedge-moss-core) for Linux x86_64 (glibc 2.35+), Linux aarch64, macOS arm64 and Windows. Both are source-available under PolyForm Shield 1.0.0: free for any use, including commercial, except building a product that competes with Moss. Please say if that is a problem.Testing
Tested 2026-10-06 on this branch in TEN's dev container (
ten_agent_build:0.7.14), withmoss1.15.0, a free Moss project holding the portal's 55-document support FAQ index, and the example's vendors (Deepgram, gpt-4o, ElevenLabs).Voice calls in the playground answered from the index in both graphs: support hours, the 15% restocking fee on opened electronics, and order consolidation within 1 hour of ordering. In
moss_ambientthe LLM made no tool call; inmoss_toolit calledsearch_knowledge_basefor each question.Each search took 0 to 13 ms. Loading the index took about 2.9 s per session, in the background while the greeting plays.
From the final transcript to the first sentence sent to TTS:
moss_ambientmoss_toolWith a wrong project key, the extension logs that the index was not loaded and registers no tool, and the agent keeps running. The key does not appear in the logs.
black (line length 80) and pylint with the repo's rcfile pass for the extension.
Maintenance
Moss maintains this extension and the example: testing, documentation and compatibility updates, contributed proactively. We would appreciate advance notice of significant breaking changes in TEN, for example to the
tool_registerandtool_callmessages or tomain_python.