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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
408db80ab382d5bf125220dd7dffcba05e324d0967f4e1028583b54f238b9fbf
|
|
| MD5 |
93063cd0f16e29bf0da5b61fae2a369b
|
|
| BLAKE2b-256 |
6223deb887e485970a407d6cbcd323bd3e8a9937eb4b495bcf5e3882086da666
|
Provenance
The following attestation bundles were made for marp-0.9.0.tar.gz:
Publisher:
release.yml on marprotocol/marp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
marp-0.9.0.tar.gz -
Subject digest:
408db80ab382d5bf125220dd7dffcba05e324d0967f4e1028583b54f238b9fbf - Sigstore transparency entry: 2347658989
- Sigstore integration time:
-
Permalink:
marprotocol/marp@6256bddec91e39c723ab054b5df87c5f8266f7ae -
Branch / Tag:
refs/heads/main - Owner: https://github.com/marprotocol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6256bddec91e39c723ab054b5df87c5f8266f7ae -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b430985d9ecd71c47aa0bbfee29cf8af4f77b10026cc8bf2470d5166fb6b0ad9
|
|
| MD5 |
ee8c723db5298eccc46a04ae6f045b38
|
|
| BLAKE2b-256 |
94844e4a90525b4259d8b0c1d88303ffd0318ca279b8c4d08a1d55625f0a0e7b
|
Provenance
The following attestation bundles were made for marp-0.9.0-py3-none-any.whl:
Publisher:
release.yml on marprotocol/marp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
marp-0.9.0-py3-none-any.whl -
Subject digest:
b430985d9ecd71c47aa0bbfee29cf8af4f77b10026cc8bf2470d5166fb6b0ad9 - Sigstore transparency entry: 2347659789
- Sigstore integration time:
-
Permalink:
marprotocol/marp@6256bddec91e39c723ab054b5df87c5f8266f7ae -
Branch / Tag:
refs/heads/main - Owner: https://github.com/marprotocol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6256bddec91e39c723ab054b5df87c5f8266f7ae -
Trigger Event:
workflow_dispatch
-
Statement type: