Skip to main content

SDK for building hosted multi-agent Mash applications.

Project description

mashpy

Mash is an SDK and host runtime for building self-hosted multi-agent applications. It gives app developers a Python AgentSpec contract, a host API for composing agents and workflows, a FastAPI server for deployment, and a CLI/REPL for talking to a running host.

What Is Mash?

Mash is organized around three surfaces:

  • SDK and runtime: define agents, tools, skills, workflows, memory, and request execution.
  • API server: serve a Mash host over HTTP, including request streaming, workflow routes, and telemetry.
  • CLI: connect to a running host, open an interactive REPL, inspect sessions, and run workflows.

pilot/ is the in-repo example host app. It uses the same public Mash contracts that external host apps use, and adds Pilot-specific REPL commands such as /changelog [N].

At a high level, a Mash request flows through the host API, into an agent runtime, through the durable request engine, and back out as replayable runtime events:

sequenceDiagram
    participant User
    participant API as mash.api
    participant Host as AgentHost
    participant Client as AgentClient
    participant Server as AgentServer
    participant Runtime as AgentRuntime
    participant Events as RuntimeStore
    participant Engine as RequestEngine
    participant Agent as mash.core.Agent
    participant Memory as Memory Store

    User->>API: POST /api/v1/agents/{agent_id}/requests
    API->>Host: get_client(agent_id)
    Host-->>API: AgentClient
    API->>Client: post_request(...) / stream(...)
    Client->>Server: HTTP request + SSE stream
    Server->>Runtime: submit_request(...) / stream_request_events(...)
    Runtime->>Events: append request.accepted
    Runtime->>Engine: start_request(...)
    Engine->>Agent: think -> act -> observe
    Agent-->>Engine: response + trace + token usage
    Engine->>Memory: save_turn(...)
    Engine->>Events: append request.started / agent.trace / request.completed
    Runtime-->>Server: replay persisted events
    Server-->>Client: SSE runtime events
    Client-->>API: streamed runtime events
    API-->>User: SSE / final payload

What Is In This Repo?

src/mash/                  Mash package: SDK, runtime, API, CLI, workflows
pilot/                     Example Mash host app built on the SDK
docs/rfcs/                 Protocol and design RFCs
tests/                     Mash and Pilot test suites
Dockerfile                 Base image for Mash host deployments

Quick Start

Create and activate the repo environment:

uv venv
uv sync
source .venv/bin/activate

Run the main test suites:

uv run --extra dev pytest -q tests/mash
uv run --extra dev pytest -q tests/pilot

Run Pilot Locally

Start the Pilot host:

mash host serve --host-app pilot.spec:build_host --host 127.0.0.1 --port 8001

In another terminal, connect the Mash CLI:

mash connect --api-base-url http://127.0.0.1:8001 --api-key secret --agent pilot
mash status
mash agents

Open the Pilot REPL, which includes Pilot-only commands such as /changelog [N]:

pilot repl

Example messages inside the REPL:

> Summarize how HostBuilder wires the primary agent, subagents, and workflows. Cite the key files.
> Trace how an accepted request moves through AgentRuntime, RuntimeStore, and RequestEngine.
> Explain when request.waiting is emitted and what that means for a busy session.
> Compare src/mash/runtime and src/mash/workflows responsibilities in this repo.
/changelog 5

The API server also serves the telemetry UI at:

Build Your Own Host

A Mash app defines one or more AgentSpecs and returns a host from build_host():

from mash.core.config import AgentConfig
from mash.core.llm import AnthropicProvider
from mash.runtime import AgentSpec, HostBuilder
from mash.skills import SkillRegistry
from mash.tools import ToolRegistry


class PrimaryAgent(AgentSpec):
    def get_agent_id(self) -> str:
        return "primary"

    def build_tools(self) -> ToolRegistry:
        return ToolRegistry()

    def build_skills(self) -> SkillRegistry:
        return SkillRegistry()

    def build_llm(self):
        return AnthropicProvider(app_id="primary")

    def build_agent_config(self) -> AgentConfig:
        return AgentConfig(
            app_id="primary",
            system_prompt="You are helpful.",
        )


def build_host():
    return HostBuilder().primary(PrimaryAgent()).build()

Serve it with:

mash host serve --host-app my_app:build_host --host 0.0.0.0 --port 8000

For containerized deployments, use the root Dockerfile as the base host image and configure startup with MASH_HOST_APP, MASH_DATA_DIR, and MASH_DATABASE_URL.

Documentation Map

  • Product brief: product-level pitch of what Mash offers and where it fits.
  • Mash package: package overview and boundaries.
  • Runtime: host composition, request execution, persistence, structured output, and runtime internals.
  • Workflows: code-defined workflows, dynamic publishing, task state, and DBOS orchestration.
  • Skills: filesystem and inline skills plus dynamic skill registration.
  • API: HTTP surface, request/response shapes, telemetry, and dynamic publishing endpoints.
  • CLI: mash commands and REPL slash commands.
  • LLM providers: provider adapters, normalized LLM contracts, and provider-native structured output.
  • Masher: built-in workflow-only trace digest and online eval worker.
  • Pilot: example host composition and Pilot-specific REPL behavior.

Other useful module guides:

Development

Use the focused module READMEs above as the source of truth when changing a subsystem. For cross-surface behavior, update tests across the relevant layers:

  • runtime changes: tests/mash/runtime
  • API changes: tests/mash/api
  • CLI/REPL changes: tests/mash/cli
  • workflow changes: tests/mash/workflows
  • Pilot changes: tests/pilot

Before handing off broad changes, run:

uv run --extra dev pytest -q tests/mash
uv run --extra dev pytest -q tests/pilot

RFCs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mashpy-0.3.9.tar.gz (206.3 kB view details)

Uploaded Source

Built Distribution

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

mashpy-0.3.9-py3-none-any.whl (251.3 kB view details)

Uploaded Python 3

File details

Details for the file mashpy-0.3.9.tar.gz.

File metadata

  • Download URL: mashpy-0.3.9.tar.gz
  • Upload date:
  • Size: 206.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mashpy-0.3.9.tar.gz
Algorithm Hash digest
SHA256 943544d0d8d86cf26e0544b306f46916799970f0c1f79fea7e907ba5904646cb
MD5 c51dcea0510e0f298ca93fcb9d23f9d5
BLAKE2b-256 e1a6e14bc3d0a1ba8a47ff3d6f70714d0ebad017c14dc0d9eb78844d340e0942

See more details on using hashes here.

Provenance

The following attestation bundles were made for mashpy-0.3.9.tar.gz:

Publisher: publish.yml on imsid/mashpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mashpy-0.3.9-py3-none-any.whl.

File metadata

  • Download URL: mashpy-0.3.9-py3-none-any.whl
  • Upload date:
  • Size: 251.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mashpy-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 175d32bcf64516a97c98314403c22bd4815eed4df9ddcd5f1cf5b1c901cdbfa0
MD5 eb340a52864c89a016894af90dc0d723
BLAKE2b-256 0762fc7c0fa3c4588babfeb0088c9ea0771c4c0e7c7a3a8c69ea57d2a2645a12

See more details on using hashes here.

Provenance

The following attestation bundles were made for mashpy-0.3.9-py3-none-any.whl:

Publisher: publish.yml on imsid/mashpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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