Python client for Multicorn Shield - AI agent governance
Project description
Multicorn Shield - Python Client
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
Project details
Release history Release notifications | RSS feed
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 multicorn_shield-0.1.0.tar.gz.
File metadata
- Download URL: multicorn_shield-0.1.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78a083977f400746fad88982962b9802fcaf97467087b90c290a54aa95521e76
|
|
| MD5 |
2b8e54356016f1184ecd101e3e4edd03
|
|
| BLAKE2b-256 |
a9b05dfbe916f3cac1f41674ed2c8fc8a3bb32bba8696874fe4d604806e3f08f
|
File details
Details for the file multicorn_shield-0.1.0-py3-none-any.whl.
File metadata
- Download URL: multicorn_shield-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e2fd64ddae2b20af009a5b9d464f0dee47c70dea20bb0bc648fab930524cd5d
|
|
| MD5 |
0005e9c3067ec3731f42a15f654a4b6e
|
|
| BLAKE2b-256 |
3806f61ef1dc44d39b7ea341a4d4db10aeb3ca4a0eb2224af0b28c65b1c6b244
|