Skip to main content

Meshagent

MeshAgent API

The meshagent.api is the foundation that all other packages build on. It includes foundational protocols, JWT authentication, room management, document sync, and more.

JWT Authentication

MeshAgent uses JSON Web Tokens (JWTs) to authenticate participants. A token encodes who you are (participant name) and what you’re allowed to access (project ID, room name, role). The token is signed, so the server can verify it without storing any state.

from meshagent.api import ParticipantToken
token = ParticipantToken(
    name="alice",
    project_id="your-project-id",
    api_key_id="your-api-key-id",
)
token.add_room_grant(room_name="my-room", role="user")
jwt = token.to_jwt(token="your-api-secret")

WebSocket Protocol

A WebSocket keeps a two-way connection open between your Python code and the Meshagent server. This allows instant messaging, file transfers, and document updates. WebSocketClientProtocol manages the underlying connection:

from meshagent.api import WebSocketClientProtocol
protocol = WebSocketClientProtocol(url=room_url, token=jwt)
async with protocol:
    # communication occurs over this protocol

Messages are encoded and decoded using a Protocol layer that is transport-agnostic.

RoomClient

RoomClient is the main entry point for interacting with a room. Once you pass in the protocol, the room becomes ready and you gain access to specialized sub-clients:

  • messaging: send or broadcast text/files.
  • storage: open or write files in the room.
  • sync: collaborate on structured documents.
  • agents: manage agent instances.
  • queues, datasets, livekit, and more.

Document Runtime and Schemas

SyncClient and the document runtime allow multiple participants to edit structured documents (defined by a MeshSchema) with real-time updates propagated via WebSocket messages.

WebhookServer

WebhookServer can run in your own service to receive signed room.call handoffs from MeshAgent.

Meshagent

Separate from rooms, Meshagent is a REST-based client for managing projects, API keys, and secrets. It is useful for administrative tasks.

ServiceHost

ServiceHost allows you to expose agents or tools as an HTTP service. The MeshAgent Server or CLI can invoke the service via webhook calls. The Servicehost spins up the agent or tool, connects it to the specified room, and manages its lifecycle until the call completes or is dismissed. This is how examples like the ChatBot or VoiceBot can be run locally and also enables you to deploy an agent as a MeshAgent Service using the same applicable service path once your agent or tool is ready.

When a call to the agent or tool arrives through a webhook, the ServiceHost spawns that agent or tool and connects it to the requested room via the RoomClient and WebSocketClientProtocol. The ServiceHost starts an HTTP servier and registers each path so that multiple agents or toolkits can be hosted.

from meshagent.api.services import ServiceHost

service = ServiceHost() # port defaults to an available port if not assigned

@service.path("/chat")
class SimpleChatbot(ChatBot):
    ...
print(f"running on port {service.port}")
asyncio.run(service.run())

Learn more about MeshAgent on our website or check out the docs for additional examples!

Website: www.meshagent.com

Documentation: docs.meshagent.com


Metadata

Release files for meshagent-api 0.55.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 meshagent-api 0.55.0
File Size Uploaded Provenance
meshagent_api-0.55.0.tar.gz 251.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for meshagent-api 0.55.0
File Interpreter ABI Platform
meshagent_api-0.55.0-py3-none-any.whl Python 3 none any Details

Total release size: 525.7 kB

Release files / meshagent_api-0.55.0.tar.gz

Download URL meshagent_api-0.55.0.tar.gz
Size 251.8 kB
Tags Source
SHA-256 checksum
How to use checksums
021d4a4d5295bbdcbb3e2d86f38f32bd438d21fd836c3c7b8c983774d26806d4
BLAKE2b-256 checksum
How to use checksums
0a10bb152d6dec478bdb138944f2f767d65321a1603a85a0dee2095cdb7656a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / meshagent_api-0.55.0-py3-none-any.whl

Download URL meshagent_api-0.55.0-py3-none-any.whl
Size 273.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bfca73119521ff3313854b40ee91a107568aba25827868b9dd103d20772fd270
BLAKE2b-256 checksum
How to use checksums
65f461f57a458fbdda763e18a9e2472bf7534cbdc0e1353bc9de27fcb9cc8e65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for meshagent-api 0.55.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.55.0 This release

2 release files No provenance

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