Skip to main content

cedar-agent-schemas (Python)

Python helpers for constructing Cedar authorization requests against the canonical agent action schema at schemas/agent-actions.cedarschema.json.

Install

pip install cedar-agent-schemas

Usage

from cedar_agent_schemas import (
    AgentPrincipal,
    RequestToolContext,
    build_request_tool_request,
)

req = build_request_tool_request(
    principal=AgentPrincipal(
        agent_id="claude-code-3a2f",
        trust_score="0.85",
        ring=2,
        session_id="sess-9af21",
    ),
    tool_id="Bash",
    context=RequestToolContext(
        args_hash="sha256:e4d61f7a...",
        transport="mcp_stdio",
    ),
)

# req.to_dict() is a Cedar-ready authorization request:
# {
#     "principal": "Agent::Principal::\"claude-code-3a2f\"",
#     "action":    "Agent::Action::\"request_tool\"",
#     "resource":  "Agent::Tool::\"Bash\"",
#     "context":   {"args_hash": "sha256:...", "transport": "mcp_stdio"},
#     "entities":  []
# }

Pass req.to_dict() to any Cedar evaluator (cedar-py, cedar-wasm via PyO3, or a remote evaluator).

Exported

Types

AgentPrincipal, AgentFile, AgentEndpoint, AgentTool, AgentExecutable — canonical entity attribute shapes (dataclasses).

ExecContext, OpenContext, ConnectContext, RequestToolContext — per-action context shapes.

CedarAuthorizationRequest — the request shape expected by Cedar evaluators (with .to_dict() serializer).

ActionVerb"exec" | "open" | "connect" | "request_tool".

Builders

build_exec_request, build_open_request, build_connect_request, build_request_tool_request.

entity_uid(type, id), action_uid(verb) — low-level UID builders.

Constants

SCHEMA_NAMESPACE = "Agent".

Schema version

This package version tracks the schema version. cedar-agent-schemas==0.1.x uses agent-actions.cedarschema.json at v0.1 (additive-only between minor versions).

License

Apache-2.0. Same license as Cedar itself.

Release files for cedar-agent-schemas 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 cedar-agent-schemas 0.1.0
File Size Uploaded
cedar_agent_schemas-0.1.0.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cedar-agent-schemas 0.1.0
File Interpreter ABI Platform
cedar_agent_schemas-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.0 kB

Release files / cedar_agent_schemas-0.1.0.tar.gz

Download URL cedar_agent_schemas-0.1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
013a063f99f284315af2ca82ea30dfdbd25fcc3685ef142c302a2b01805fc244
BLAKE2b-256 checksum
How to use checksums
d482e664304293a5d17ccd2101e665152a58ac485a532bab08e15b238ac4d099
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.6

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

Download URL cedar_agent_schemas-0.1.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2def75c91503cd4ff38f5a423c1ba5877c9d4540a0869f88fa23702421d7b93
BLAKE2b-256 checksum
How to use checksums
dd5fc3b7c7978aaa04aebe951e96a0685e29c375f9592b4f1fd7788f21f3fd79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.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