Skip to main content

aamp-sdk

Python SDK for AAMP.

This SDK now includes the same core runtime shape as the Node.js SDK:

  • AAMP discovery and mailbox registration
  • directory query and profile updates
  • realtime stream create / append / get / close
  • AAMP header builders and parsers
  • SMTP sending for task.dispatch, task.result, task.cancel, task.help_needed, task.stream.opened, pair.request, pair.respond, and card.*
  • JMAP WebSocket push reception with polling fallback
  • attachment blob download
  • recent mailbox reconciliation as a safety net

See the repository-wide SDK capability matrix and shared conformance fixtures for parity across Node.js, Python, and Go.

Install

python -m pip install aamp-sdk

Usage

from aamp_sdk import AampClient

client = AampClient.from_mailbox_identity(
    email="agent@example.com",
    smtp_password="<smtp-password>",
    base_url="https://meshmail.ai",
    reject_unauthorized=False,
)

def on_dispatch(task: dict) -> None:
    client.send_result(
        to=task["from"],
        task_id=task["taskId"],
        status="completed",
        output="done",
        in_reply_to=task["messageId"],
    )

client.on("task.dispatch", on_dispatch)
client.connect()

task_id, message_id = client.send_task(
    to="dispatcher@example.com",
    title="Prepare a summary",
    body_text="Summarize the latest rollout status.",
    priority="high",
    # session_key reuses the callee's underlying agent session across
    # multiple task turns; omit it to start a fresh session.
    session_key="rollout-thread-42",
)

stream = client.create_stream(task_id=task_id, peer_email="dispatcher@example.com")
client.send_stream_opened(
    to="dispatcher@example.com",
    task_id=task_id,
    stream_id=stream["streamId"],
    in_reply_to=message_id,
)
client.append_stream_event(
    stream_id=stream["streamId"],
    event_type="status",
    payload={"stage": "running"},
)

client.send_result(
    to="dispatcher@example.com",
    task_id=task_id,
    status="completed",
    output="done",
    in_reply_to=message_id,
)

Pairing

task_id, message_id = client.send_pair_request(
    to="agent@example.com",
    pair_code="abc123",
    dispatch_context_rules={"source": ["wechat"]},
)

client.send_pair_respond(
    to="bridge@example.com",
    task_id=task_id,
    success=True,
    in_reply_to=message_id,
)

Parse AAMP headers

from aamp_sdk import parse_aamp_headers

message = parse_aamp_headers(
    {
        "from": "dispatcher@example.com",
        "to": "agent@example.com",
        "subject": "[AAMP Task] Review patch",
        "messageId": "<msg-1@example.com>",
        "bodyText": "Please review the patch.",
        "headers": {
            "X-AAMP-Intent": "task.dispatch",
            "X-AAMP-TaskId": "task-123",
            "X-AAMP-Priority": "high",
        },
    }
)

Run tests

cd packages/sdks/python
python -m unittest discover -s tests

Metadata

Release files for aamp-sdk 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aamp-sdk 0.1.2
File Size Uploaded Provenance Actions
aamp_sdk-0.1.2.tar.gz 25.9 kB Without provenance Details for aamp_sdk-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aamp-sdk 0.1.2
File Interpreter ABI Platform Actions
aamp_sdk-0.1.2-py3-none-any.whl Python 3 none any Details for aamp_sdk-0.1.2-py3-none-any.whl

Total release size: 46.0 kB

Release files / aamp_sdk-0.1.2.tar.gz

Download URL aamp_sdk-0.1.2.tar.gz
Size 25.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6af30a02950c19ef269e47e50f5cef2214e07b674dc6042e956598fde5fddb03
BLAKE2b-256 checksum
How to use checksums
d5a705915257f8b1d0794db93b35b492efcb8dde26079329f229552ff9c8fe06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / aamp_sdk-0.1.2-py3-none-any.whl

Download URL aamp_sdk-0.1.2-py3-none-any.whl
Size 20.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a9cd78c68f8e0b99ad5f8f878071b4383ab94e522ef1a93dd0f0a5c879a1d04
BLAKE2b-256 checksum
How to use checksums
81753db6f82782a42407dc904928519708b44d409db31d359650ccb28ed53d14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for aamp-sdk 0.1.2

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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