Expand description
Cedar policy authorization of tool calls.
CedarAuthorization evaluates Cedar policies before each tool
call. A call maps to the request principal, Action::"<tool name>", Resource::"agent" and
the context { input: <tool input>, session: { hour_utc, call_count, ..enricher } }. It runs
the native cedar-policy engine through the JSON interface of Cedar’s WebAssembly build, so
decisions and messages match the other Strands SDKs.
use strands::Agent;
use strands::testing::MockModel;
use strands::vended_interventions::cedar::{CedarAuthorization, CedarAuthorizationConfig};
let cedar = CedarAuthorization::new(CedarAuthorizationConfig {
policies: r#"permit(principal, action == Action::"search", resource);"#.into(),
..Default::default()
})?;
let agent = Agent::builder()
.model(MockModel::new())
.interventions([cedar])
.printer(false)
.build()?;Structs§
- Cedar
Authorization - Authorizes each tool call against Cedar policies (
CedarAuthorization). - Cedar
Authorization Config - Settings of a
CedarAuthorization(CedarAuthorizationConfig). - Cedar
Authorization Config Builder - Use builder syntax to set the inputs and finish with
build(). - Context
Enricher - Adds fields to
context.session; it cannot overwritehour_utcorcall_count. - Context
Enricher Input - What a
ContextEnrichergets. - Principal
Resolver - Resolves the principal from the invocation state;
Nonedenies. - Tool
Definition - A tool for schema generation, in the MCP tool shape (
ToolDefinition). - Type
AndId - A Cedar entity reference (
TypeAndId).
Enums§
- Cedar
Entities - Entity data: Cedar entity JSON, or the path of a
.jsonfile.
Constants§
- CEDAR_
AUTHORIZATION_ STATE_ KEY - The app-state key of the per-tool call counts.