Skip to main content

Living Agents Protocol (LAP) — Python Reference & FastMCP Middleware

Official Python implementation of the Living Agents Protocol (LAP):

  • LIP-1 Agent Passport: Ed25519 JWS identity documents with responsible-human principal binding.
  • LIP-3 Scope Algebra (v0.2): Capability attenuation, DAG action lattices, resource prefix matching, and integer budget conservation.
  • LIP-4 Micro-Core: FastMCP middleware for server-side authorization, RFC 9421 request signature validation, and signed tripartite audit receipts.

Zero runtime dependencies beyond cryptography.


Installation

Not yet published to PyPI — install from the repository:

cd lap-python
pip install -e ".[dev]"

FastMCP / MCPServer Tool Server Integration (3 Lines)

The decorator is SDK-agnostic: it works with FastMCP (mcp 1.x) and MCPServer (mcp 2.x) alike.

Complete runnable example (server + client, verified in CI): ../examples/mcp-server/ — the 15-minute tutorial.

Wrap any MCP tool function with @verify_envelope to enforce authorization bounds and emit tripartite receipts:

from mcp.server.fastmcp import FastMCP
from living_agents import verify_envelope
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey

mcp = FastMCP("billing-tools")

# Server Ed25519 signing key for receipts
server_key = Ed25519PrivateKey.generate()
server_did = "did:key:z6MknvBY..."

@mcp.tool()
@verify_envelope(
    action="finance:pay",
    resource="mcp://tools.example.com/billing/pay",
    amount_param="amount",
    unit_param="unit",
    server_private_key=server_key,
    server_did=server_did,
)
def pay_invoice(invoice: str, amount: int, unit: str = "USD") -> dict:
    """Pay a vendor invoice up to authorized envelope limits."""
    return {"status": "paid", "invoice": invoice, "amount": amount}

When an agent invokes pay_invoice:

  1. LAP-Passport is verified against the principal's did:key.
  2. RFC 9421 LAP-Signature is validated over the canonical body digest.
  3. Envelope spending cap is enforced (amount <= max_per_tx).
  4. An immutable _lap_receipt is signed by the server and returned to the caller.

Running Cross-Language Tests

Run the complete test suite:

pytest tests/ -v

The test suite validates byte-for-byte reproducibility against the shared deterministic test vectors (output/lip/test-vectors/vectors.json), ensuring full interoperability with the Node.js reference implementation.


License

Apache-2.0. Part of the Living Agents Protocol project.

Metadata

Release files for living-agents 0.4.11

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

Source distribution (sdist)

Source distribution for living-agents 0.4.11
File Size Uploaded
living_agents-0.4.11.tar.gz 37.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for living-agents 0.4.11
File Interpreter ABI Platform
living_agents-0.4.11-py3-none-any.whl Python 3 none any Details

Total release size: 60.5 kB

Release files / living_agents-0.4.11.tar.gz

Download URL living_agents-0.4.11.tar.gz
Size 37.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d79bb18f11248e06db23806f6d069566c755670cdf462fcc9377df8678ae5243
BLAKE2b-256 checksum
How to use checksums
03b982b7e456573916d70602337ffc4c47f2241c829ae4b885c78b3ac7233c2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Release files / living_agents-0.4.11-py3-none-any.whl

Download URL living_agents-0.4.11-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e21567d67976acd1443a466fb987ed5f3c43e10763d443d6dc46dd75a1e88cb7
BLAKE2b-256 checksum
How to use checksums
49efa11eaac99022c68584818a6a9570ed92217ab4c3aff60cc6c859c199c3da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Release history Release notifications | RSS feed

0.4.12

2 release files

This release

0.4.11 This release

2 release 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