Skip to main content

MARP Python SDK

Typed, dependency-free, synchronous implementation of Minimal Assistant Room Protocol (MARP) 0.9.0.

Conforms to MARP 0.9 Core, Direct JSON Profile, and Function Calling Profile. Multi-reply profile: first by default (also supports all and nonblocking).

This library is unrelated to the Marp Markdown-presentation ecosystem.

The approved distribution and import name is marp.

pip install marp

The canonical protocol specification is at https://github.com/marprotocol/marp/blob/main/PROTOCOL.md.

from marp import RoomState

room = RoomState()
room.join("u1")
turn = room.accept_direct({"messages": [{"to": ["u1"], "text": "Hello"}], "reply_from": ["u1"]})
room.present_next()
assert room.capture_message("u1", "Hi") == "waiting"
assert room.complete_presentation() == "advanced"

Private delivery is routing metadata only: room operators and model providers processing a room can access delivery contents.

accept_event, join, and leave return "accepted". capture_message automatically adds the active pending reply_to when omitted and returns "advanced", "waiting", or "accepted"; inspect normalized_history() for the server-created event. Present a turn, then call complete_presentation() to make its completion observable. accept_calls() is atomic and returns ordered queued or typed rejected acknowledgements.

For function-calling providers, retain the original provider assistant item and append function_history(assistant_item, acknowledgements); this produces one correlated tool result per call ID and does not duplicate normalized turns in provider history.

Copy-paste examples

Parse

from marp import parse_event

event = parse_event({"event": "message", "user": "u1", "text": "Hello"})

Validate

from marp import parse_turn, validate_turn

turn = validate_turn(parse_turn({"messages": [], "reply_from": []}), ["u1"])

Ordered calls

from marp import RoomState, ToolCall

room = RoomState()
acks = room.accept_calls([ToolCall("c1", {"messages": [], "reply_from": []})])
assert acks[0].turn == 1

Present

from marp import RoomState

room = RoomState()
room.join("u1")
room.accept_direct({"messages": [], "reply_from": []})
assert room.present_next().turn == 1
assert room.complete_presentation() == "advanced"

Capture

from marp import RoomState

room = RoomState()
room.join("u1")
room.accept_direct({"messages": [], "reply_from": ["u1"]})
room.present_next()
assert room.capture_message("u1", "answer") == "waiting"
assert room.complete_presentation() == "advanced"

Replay

from marp import RoomState

room = RoomState()
first = room.accept_direct({"messages": [], "reply_from": []}, response_id="r1")
assert room.accept_direct({"messages": [], "reply_from": []}, response_id="r1") == first

Conformance

# From python/marp:
# python -m pytest tests/test_conformance.py

Download files

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

Source Distribution

marp-0.9.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

marp-0.9.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file marp-0.9.0.tar.gz.

File metadata

  • Download URL: marp-0.9.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for marp-0.9.0.tar.gz
Algorithm Hash digest
SHA256 408db80ab382d5bf125220dd7dffcba05e324d0967f4e1028583b54f238b9fbf
MD5 93063cd0f16e29bf0da5b61fae2a369b
BLAKE2b-256 6223deb887e485970a407d6cbcd323bd3e8a9937eb4b495bcf5e3882086da666

See more details on using hashes here.

Provenance

The following attestation bundles were made for marp-0.9.0.tar.gz:

Publisher: release.yml on marprotocol/marp

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

File details

Details for the file marp-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: marp-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for marp-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b430985d9ecd71c47aa0bbfee29cf8af4f77b10026cc8bf2470d5166fb6b0ad9
MD5 ee8c723db5298eccc46a04ae6f045b38
BLAKE2b-256 94844e4a90525b4259d8b0c1d88303ffd0318ca279b8c4d08a1d55625f0a0e7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for marp-0.9.0-py3-none-any.whl:

Publisher: release.yml on marprotocol/marp

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

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 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