Expand description
Dogwood policy authorization of tool calls.
DogwoodAuthorization evaluates a Dogwood
.dw policy set before each tool call and records each allowed call’s result afterwards, so
temporal rules (when temporal { formerly within 1h Action::"search"::response{} }) can
correlate across calls. A call maps to the principal, Action::"<tool name>" (qualified by the
schema’s namespace when it has one), Resource::"agent", and input (the tool arguments) in
both the Cedar context and the temporal record. It runs dogwood-language, the engine behind
Dogwood’s WebAssembly build, so decisions and messages match the other Strands SDKs.
use strands::Agent;
use strands::testing::MockModel;
use strands::types::ToolSpec;
use strands::vended_interventions::dogwood::{DogwoodAuthorization, DogwoodAuthorizationConfig};
let search = ToolSpec::new("search", "Search for information");
let dogwood = DogwoodAuthorization::new(DogwoodAuthorizationConfig {
policies: r#"permit(principal, action == Action::"search", resource);"#.into(),
tools: Some(vec![search]),
..Default::default()
})?;
let agent = Agent::builder()
.model(MockModel::new())
.interventions([dogwood])
.printer(false)
.build()?;Structs§
- Context
Enricher - Adds fields to the
sessiongroup of the Cedar request context, read by a policy ascontext.session.<field>. The fields reachwhen { .. }conditions only: the default event schema declares a tool’s input fields and nothing else, so a temporal predicate cannot read them. - Context
Enricher Input - What a
ContextEnrichergets. - Dogwood
Authorization - Authorizes each tool call against a Dogwood policy set (
DogwoodAuthorization). - Dogwood
Authorization Config - Settings of a
DogwoodAuthorization(DogwoodAuthorizationConfig). - Dogwood
Authorization Config Builder - Use builder syntax to set the inputs and finish with
build(). - Entity
Input - An entity supplied to every decision: its identity plus the attributes and direct parents a
policy reads (
EntityInput). - Entity
Ref - A Dogwood entity reference (
EntityRef). - Principal
Resolver - Resolves the principal from the invocation state;
Nonedenies (fail-closed).