Moss runtime for LiveKit voice agents - a hot index cache shared across rooms and a one-line attach per call.
Project description
moss-agent
Moss runtime for LiveKit voice agents - a hot index cache shared across rooms and a one-line attach per call.
Install
pip install moss-agent
Use - voice (LiveKit)
from livekit.agents import AgentServer, JobContext, JobProcess
from moss_agent import MossAgent
server = AgentServer()
def prewarm(proc: JobProcess) -> None:
agent = MossAgent(
project_id="...",
project_key="...",
)
import asyncio
asyncio.run(agent.load_indexes(["product_catalog", "faq", "policies"]))
proc.userdata["moss_agent"] = agent
server.setup_fnc = prewarm
@server.rtc_session(agent_name="my-agent")
async def handle_visit(ctx: JobContext) -> None:
await ctx.connect()
agent: MossAgent = ctx.proc.userdata["moss_agent"]
call = agent.attach(ctx)
results = await call.query("product_catalog", user_question)
# ... your existing agent loop ...
Use - text (HTTP / chat / non-LiveKit)
from moss_agent import MossAgent
# Module level - reuse across requests
agent = MossAgent(project_id="...", project_key="...")
await agent.load_indexes(["product_catalog"])
# In your HTTP / chat handler
async def handle_message(req):
results = await agent.query("product_catalog", req.user_message)
# ... feed results to your model ...
API surface
MossAgent(project_id, project_key)- process-wide instance. Build once, share across every room (voice) or every request (text).- Voice:
MossAgent.attach(ctx) -> MossCallbinds a Moss call scope to a LiveKitJobContext. Idempotent onctx.room.name.MossCall.query(name, query, options=None)andMossCall.query_multi_index(names, query, options=None)are the call-scoped query surface. - Text:
MossAgent.query(name, query, options=None)andMossAgent.query_multi_index(names, query, options=None). - Full index CRUD (
create_index,add_docs,delete_docs,delete_index,list_indexes,get_index,get_docs,get_job_status) and cache lifecycle (load_index,load_indexes,unload_index,unload_indexes) onMossAgent.
Requirements
- Python 3.10+
inferedge-moss-core == 0.12.0livekit-agents >= 0.10.0(only required if you callattach(); install via the[livekit]extra)
License
Proprietary. See LICENSE.txt.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
moss_agent-1.0.0.tar.gz
(11.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moss_agent-1.0.0.tar.gz.
File metadata
- Download URL: moss_agent-1.0.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d12d33f7ecfc91b1ce32c3634b3ece22fa54dde7bab08c1a9067556e0f3900a1
|
|
| MD5 |
17880abf08b9e6b73f55c897e96a677e
|
|
| BLAKE2b-256 |
d43bbfb981e790ee03651cd2e66875acbb013573695a97126f99de1d94543e01
|
File details
Details for the file moss_agent-1.0.0-py3-none-any.whl.
File metadata
- Download URL: moss_agent-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9079e5a9730b361adab65fce2c2ee1aa981d7de546ec6bd2f3e28cc4d33e9c0a
|
|
| MD5 |
8e9715f426f34342cbed6187220b1ba4
|
|
| BLAKE2b-256 |
74f81eed80f9f989217634db0eacfbc342fe2c45504cbe096baf2808031c5ef3
|