Skip to main content

Canonical Cedar schema library for agent action verbs (exec, open, connect, request_tool). Python helpers for constructing Cedar requests.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cedar_agent_schemas-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cedar_agent_schemas-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file cedar_agent_schemas-0.1.0.tar.gz.

File metadata

  • Download URL: cedar_agent_schemas-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.6

File hashes

Hashes for cedar_agent_schemas-0.1.0.tar.gz
Algorithm Hash digest
SHA256 013a063f99f284315af2ca82ea30dfdbd25fcc3685ef142c302a2b01805fc244
MD5 15b2a9e4c5d7415efdf52a489f135980
BLAKE2b-256 d482e664304293a5d17ccd2101e665152a58ac485a532bab08e15b238ac4d099

See more details on using hashes here.

File details

Details for the file cedar_agent_schemas-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cedar_agent_schemas-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b2def75c91503cd4ff38f5a423c1ba5877c9d4540a0869f88fa23702421d7b93
MD5 79d05736d111872e7e88a6009b38c562
BLAKE2b-256 dd5fc3b7c7978aaa04aebe951e96a0685e29c375f9592b4f1fd7788f21f3fd79

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page