Skip to main content

Multicorn Shield - Python Client

MIT Licence PyPI version

Python client for Multicorn Shield, the open-source AI agent governance platform.

Install

pip install multicorn-shield

Quick start

from multicorn_shield import ShieldClient

client = ShieldClient(api_key="mcs_your_key_here")

result = client.log_action(
    agent_id="your-agent-uuid",  # from the dashboard or list_agents()
    service="gmail",
    action_type="send_email",
    cost=2,  # 2 cents
    metadata={"recipient": "user@example.com"},
)

print(result.status)  # APPROVED, BLOCKED, PENDING, etc.

The client also works as a context manager:

with ShieldClient(api_key="mcs_your_key_here") as client:
    agents = client.list_agents()
    for agent in agents:
        print(f"{agent.name} ({agent.status})")

Async usage

import asyncio
from multicorn_shield import AsyncShieldClient

async def main():
    async with AsyncShieldClient(api_key="mcs_your_key_here") as client:
        result = await client.log_action(
            agent_id="your-agent-uuid",  # from the dashboard or list_agents()
            service="gmail",
            action_type="send_email",
        )
        print(result.status)

asyncio.run(main())

API methods

Method Description
log_action(agent_id, service, action_type, ...) Submit an action to the policy engine (cost in cents)
get_agent(agent_id) Fetch a single agent by ID
list_agents() List all agents visible to your API key
list_scopes(agent_id) List all permission scopes for an agent
check_scopes(agent_id, service) Check resolved permissions for an agent on a service
get_spending(agent_id) Fetch spending limits for an agent (values in cents)

Both ShieldClient and AsyncShieldClient expose the same methods. The async variant returns coroutines.

TypeScript SDK

The TypeScript SDK has additional features not yet available in the Python client:

  • Consent screens (Shadow DOM web component)
  • MCP adapter (middleware for MCP tool call interception)
  • MCP proxy (wrap any MCP server with zero code changes)
  • Client-side spending enforcement with integer-cents arithmetic

Documentation

Full docs at multicorn.ai/shield.

Licence

MIT - Multicorn AI Pty Ltd

Metadata

Release files for multicorn-shield 0.1.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 multicorn-shield 0.1.0
File Size Uploaded
multicorn_shield-0.1.0.tar.gz 7.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for multicorn-shield 0.1.0
File Interpreter ABI Platform
multicorn_shield-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / multicorn_shield-0.1.0.tar.gz

Download URL multicorn_shield-0.1.0.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
78a083977f400746fad88982962b9802fcaf97467087b90c290a54aa95521e76
BLAKE2b-256 checksum
How to use checksums
a9b05dfbe916f3cac1f41674ed2c8fc8a3bb32bba8696874fe4d604806e3f08f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / multicorn_shield-0.1.0-py3-none-any.whl

Download URL multicorn_shield-0.1.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e2fd64ddae2b20af009a5b9d464f0dee47c70dea20bb0bc648fab930524cd5d
BLAKE2b-256 checksum
How to use checksums
3806f61ef1dc44d39b7ea341a4d4db10aeb3ca4a0eb2224af0b28c65b1c6b244
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.0 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