Skip to main content

muad-skill-http

Trace-aware HTTP helpers and a platform request client for muad skills.

platform_request() sends business-platform requests using a session state file resolved by the caller. The Skill runs session-manager get-state --skill-name <name> and passes the returned sessionStateFile; the SDK never runs session-manager itself. It assembles the browser defaults, platform host header, platform static headers, cookies, CSRF header and a fresh Traceid UUID v4 for every request, and re-asserts the mandatory headers last so caller headers cannot override them. Cookie and CSRF values never reach the trace spool.

Install

pip install muad-skill-http

Usage

import json
import subprocess

from muad_skill_http import get, platform_request

# Plain HTTP with trace accounting.
response = get("https://example.com/api/v1/items")

# Resolve the login state with session-manager, then pass its state file.
completed = subprocess.run(
    ["session-manager", "get-state", "--skill-name", "my-skill"],
    capture_output=True, text=True, check=True,
)
state_file = json.loads(completed.stdout)["sessionStateFile"]
response = platform_request(
    "demo", "GET", "/api/v1/targets", state_file=state_file,
)

# Optional: a reusable client bound to the same state file.
from muad_skill_http import platform

client = platform("demo", state_file)
response = client.get("/api/v1/targets")

get / post / put / patch / delete / head / options / request wrap requests and record request counts for the current skill execution.

Local development: build a state file from browser cookies

build_local_state converts the Cookie request header copied from browser DevTools into the state JSON expected by state_file. It also writes the cookies into storageState; cookie values are never logged.

import json

from muad_skill_http import build_local_state

state = build_local_state(
    "demo",
    "Cookie: session=...; csrf_token=...",
    base_url="https://demo.example.internal",
    host_header={"Host": "demo.example.internal"},
    csrf=[{"cookie": "csrf_token", "header": "x-csrftoken"}],
)
with open("/home/me/muad-local/demo.json", "w", encoding="utf-8") as handle:
    json.dump(state, handle)

Multiple platforms can share one file with merge_local_states:

from muad_skill_http import build_local_state, merge_local_states

state = merge_local_states(
    build_local_state("mssw", mssw_cookie_header, base_url="https://mssw.example.internal"),
    build_local_state("mssp", mssp_cookie_header, base_url="https://mssp.example.internal"),
)

cookies_from_header("a=1; b=2") returns just the parsed cookie list. These helpers are for local development only; production sessions come from session-manager get-state. The skill template reads ~/.muad-local/session-state.json when MUAD_SESSION_KEY is absent, so local runs do not need a session-manager binary. Never commit a filled-in state file.

Runtime requirements for platform_request

platform_request requires the state_file argument: the sessionStateFile returned by session-manager get-state. Resolving the session is the Skill's responsibility; the SDK does not run session-manager or read credentials from the environment. If the file is missing, malformed, expired, or lacks the requested platform, the SDK raises muad_skill_http.PlatformSessionError before sending any request.

Plain get / post calls work anywhere.

Environment variables

Variable Purpose
MUAD_TRACE_SPOOL Optional JSONL trace spool path; paired with MUAD_EXECUTION_ID.
MUAD_EXECUTION_ID Execution id written to the trace spool.
MUAD_SKILL_REQUEST_LIMIT Per-execution interface request limit; unset or 0 means unlimited. Exceeding the limit exits with code 86.

I/O failures while writing the trace spool are swallowed: auditing never breaks a skill request.

Development

python -m pytest test

Releases are published by pushing an sdk-v* tag; the tag must match project.version in pyproject.toml.

Metadata

Release files for muad-skill-http 0.2.0

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

Source distribution (sdist)

Source distribution for muad-skill-http 0.2.0
File Size Uploaded Provenance Actions
muad_skill_http-0.2.0.tar.gz 18.4 kB With provenance Details for muad_skill_http-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for muad-skill-http 0.2.0
File Interpreter ABI Platform Actions
muad_skill_http-0.2.0-py3-none-any.whl Python 3 none any Details for muad_skill_http-0.2.0-py3-none-any.whl

Total release size: 31.3 kB

Release files / muad_skill_http-0.2.0.tar.gz

Download URL muad_skill_http-0.2.0.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
58bbcff714d5a6e03457edfdf35b9c51876f3ca44a69b3473103936f49972c04
BLAKE2b-256 checksum
How to use checksums
2294cf712bb9c81a64de9a30bf0eeb0dc6dc562c80c7a931989a063963b7a2e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / muad_skill_http-0.2.0-py3-none-any.whl

Download URL muad_skill_http-0.2.0-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a39525a0be4ea853d4c35fda2540ddc8c84aaf7ce136f2c01b9ecfffcef43e8a
BLAKE2b-256 checksum
How to use checksums
d6c48bb91a359932429b93979241f8c2fe58a403b5965fa249a238a5262f5ab3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for muad-skill-http 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for muad_skill_http-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

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