Skip to main content

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) -> MossCall binds a Moss call scope to a LiveKit JobContext. Idempotent on ctx.room.name. MossCall.query(name, query, options=None) and MossCall.query_multi_index(names, query, options=None) are the call-scoped query surface.
  • Text: MossAgent.query(name, query, options=None) and MossAgent.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) on MossAgent.

Requirements

  • Python 3.10+
  • inferedge-moss-core == 0.12.0
  • livekit-agents >= 0.10.0 (only required if you call attach(); install via the [livekit] extra)

License

Proprietary. See LICENSE.txt.

Metadata

Release files for moss-agent 1.0.0

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

Source distribution (sdist)

Source distribution for moss-agent 1.0.0
File Size Uploaded
moss_agent-1.0.0.tar.gz 11.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for moss-agent 1.0.0
File Interpreter ABI Platform
moss_agent-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.1 kB

Release files / moss_agent-1.0.0.tar.gz

Download URL moss_agent-1.0.0.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d12d33f7ecfc91b1ce32c3634b3ece22fa54dde7bab08c1a9067556e0f3900a1
BLAKE2b-256 checksum
How to use checksums
d43bbfb981e790ee03651cd2e66875acbb013573695a97126f99de1d94543e01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / moss_agent-1.0.0-py3-none-any.whl

Download URL moss_agent-1.0.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9079e5a9730b361adab65fce2c2ee1aa981d7de546ec6bd2f3e28cc4d33e9c0a
BLAKE2b-256 checksum
How to use checksums
74f81eed80f9f989217634db0eacfbc342fe2c45504cbe096baf2808031c5ef3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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