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.

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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moss_agent-1.0.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

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

Hashes for moss_agent-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d12d33f7ecfc91b1ce32c3634b3ece22fa54dde7bab08c1a9067556e0f3900a1
MD5 17880abf08b9e6b73f55c897e96a677e
BLAKE2b-256 d43bbfb981e790ee03651cd2e66875acbb013573695a97126f99de1d94543e01

See more details on using hashes here.

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

Hashes for moss_agent-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9079e5a9730b361adab65fce2c2ee1aa981d7de546ec6bd2f3e28cc4d33e9c0a
MD5 8e9715f426f34342cbed6187220b1ba4
BLAKE2b-256 74f81eed80f9f989217634db0eacfbc342fe2c45504cbe096baf2808031c5ef3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page