Skip to main content

SDK for building hosted multi-agent Mash applications.

Project description

Mash

A Python SDK and host runtime for building self-hosted multi-agent applications.

Mash gives you a Python AgentSpec contract for defining agents, a HostBuilder for composing them into a multi-agent host, a FastAPI server for deployment, and a CLI/REPL for interacting with a running host.

Install

pip install mashpy

Requires Python >= 3.10. Set your LLM provider key:

export ANTHROPIC_API_KEY=...   # or OPENAI_API_KEY or GEMINI_API_KEY

What Mash Provides

  • Multi-agent composition — define a primary agent, add specialized subagents, and compose workflows behind a single host. Agents delegate to each other without a separate coordination layer.
  • Durable harness — requests execute through a durable engine and are recorded as replayable runtime events. Retries, restarts, and long-running work just work.
  • Human-in-the-loop — agents can pause for approval or ask users questions mid-execution. Interactions survive host restarts.
  • Workflows — ordered task sequences with structured output, defined in code or published dynamically at runtime.
  • Observability — span trees, trace analysis, telemetry API, built-in dashboard, and CLI trace inspection. No external APM needed.
  • Self-hosted interfaces — HTTP API with streaming, CLI, and interactive REPL. Deploy locally, in Docker, or on any cloud.
                  ┌─────────────────────────────────────────┐
                  │          Durable Request                │
                  │                                         │
                  │   ┌─ context ─── memory ──┐             │
                  │   │                       │             │
request ────────► │   │     Agent Loop        │ ──► signals │
(cli/api)         │   │ think → act → observe │      │      │
                  │   │                       │      ▼      │
                  │   └─ tools ───── skills ──┘  structured │
workflow ───────► │        ▲                      output    │
(schedule/trigger)│        │ user interaction               │
                  │        ▼ (approval / ask-user)          │
                  │                                         │
                  │       resumable · replayable            │
                  └─────────────────────────────────────────┘

See Mash under the hood for a deeper look at each capability, and the product brief for the pitch.

Quick Start

1. Define an agent

# my_agent/spec.py
from mash.core.config import AgentConfig
from mash.core.llm import AnthropicProvider
from mash.runtime import AgentMetadata, AgentSpec, HostBuilder
from mash.skills import SkillRegistry
from mash.tools import ToolRegistry


class AssistantAgent(AgentSpec):
    def get_agent_id(self) -> str:
        return "assistant"

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

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

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

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


def build_pool():
    return (
        HostBuilder()
        .agent(
            AssistantAgent(),
            metadata=AgentMetadata(
                display_name="Assistant",
                description="General-purpose assistant.",
                capabilities=["conversation"],
                usage_guidance="Default agent for user requests.",
            ),
        )
        .build()
    )

2. Serve it

mash host serve --host-app my_agent.spec:build_pool --port 8000

3. Connect

mash connect --api-base-url http://127.0.0.1:8000 --api-key secret --agent assistant
mash repl

Key Concepts

Concept What it is
AgentSpec Abstract contract defining one agent (id, tools, skills, LLM, config)
HostBuilder Fluent builder that composes agents, workflows, and hosts into an AgentPool
AgentPool The deployed pool of role-less agents the API server runs
Host A composition over the pool (primary + subagents + workflows), defined in code or dynamically over the API
ToolRegistry Register callable tools; built-ins include Bash, AskUser, InvokeSubagent
SkillRegistry Markdown instruction bundles loaded on demand via a meta-tool
LLMProvider Adapters for Anthropic, OpenAI, and Gemini
WorkflowSpec Ordered task chains with structured output, orchestrated by DBOS

Example: Mash Pilot

Mash Pilot is a full example host app built on the Mash SDK. It demonstrates multi-agent composition, custom REPL commands, workflows, and deployment. Use it as a reference when building your own host.

Build with a Coding Agent

This repo includes CLAUDE.md so coding agents like Claude Code, Codex, and Cursor can scaffold a Mash-powered agent from a natural language prompt. Copy it into your project or point your agent at this repo to get started. The Pilot agent also includes a build-mash-agent skill for interactive agent scaffolding.

Documentation

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.5.3.tar.gz (222.8 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.5.3-py3-none-any.whl (270.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mashpy-0.5.3.tar.gz
Algorithm Hash digest
SHA256 8db789d07753c5f99fe091e16515e0d0e2456d68ecd841de968918a3e39b83d2
MD5 4ca52d70f2d623b9d4fb5b19798091a2
BLAKE2b-256 f8df08ceee9014a690a1a4a2b48005bb2c9712fcbe6113df917a9118e3bf0fa4

See more details on using hashes here.

Provenance

The following attestation bundles were made for mashpy-0.5.3.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.5.3-py3-none-any.whl.

File metadata

  • Download URL: mashpy-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 270.2 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.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dafd30694e9775fbd251934c948fae1a00fda7f373cd1ee97974c3ed5b969af8
MD5 7e2a1ef867066206e6c4743f1c73c692
BLAKE2b-256 f1b78c5677c7e5caaf55c1aa6fe5e3e3fe8c5091429688d0b63bd3111a763b5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mashpy-0.5.3-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