Dogwood authorization intervention handler.

#### DogwoodValue

A value Dogwood accepts in an event. `\{"__entity": EntityRef}` and `\{"__decimal": "1.50"}` are its tagged escapes.

## EntityRef

```python
class EntityRef(TypedDict)
```

Defined in: [src/strands/vended\_interventions/dogwood/dogwood.py:46](https://github.com/strands-agents/harness-sdk/blob/main/strands-py/src/strands/vended_interventions/dogwood/dogwood.py#L46)

A reference to an entity by type and id.

## EntityInput

```python
class EntityInput(TypedDict)
```

Defined in: [src/strands/vended\_interventions/dogwood/dogwood.py:53](https://github.com/strands-agents/harness-sdk/blob/main/strands-py/src/strands/vended_interventions/dogwood/dogwood.py#L53)

An entity supplied to a decision: its id, and the attributes and parents a policy reads.

#### ENRICHED\_GROUP

The one context group a `context_enricher` can add.

#### INPUT\_GROUP

The context group carrying a tool call’s arguments. Only a tool-call action declares it.

#### SYSTEM\_GROUP

The context group Dogwood’s MCP schema template declares for the wall clock.

#### PrincipalResolver

Resolves a principal from invocation\_state. Return None to deny (fail-closed).

#### ContextEnricher

Adds fields to context.session. Receives {‘tool\_name’, ‘tool\_input’, ‘invocation\_state’}.

#### EventGroups

Event field groups, `group -> \{field -> value}`.

## DogwoodAuthorization

```python
class DogwoodAuthorization(InterventionHandler)
```

Defined in: [src/strands/vended\_interventions/dogwood/dogwood.py:91](https://github.com/strands-agents/harness-sdk/blob/main/strands-py/src/strands/vended_interventions/dogwood/dogwood.py#L91)

Dogwood authorization intervention handler.

Evaluates a Dogwood policy set before each tool call, and records the result afterward so temporal rules work.

A call on tool `search` is decided as action `Action::"search"` — qualified by the schema’s namespace when it has one — against the configured principal and the gateway resource, with the tool arguments in `context.input`. Arguments are compared as the model emitted them: an enum parameter as a string, a number as a Cedar `decimal`, so a condition on one reads `context.input.amount.lessThan(decimal("10.0"))`.

One instance is one ordered temporal history, with every predicate pinned to the deciding principal, so many principals can share it without their histories mixing. History is never pruned; :meth:`reset` drops every principal’s at once. A result’s fields are not recorded, only that the call returned, so a predicate on one type-checks and then never matches.

Dogwood checks a call against the schema before it will decide, so an argument the tool does not declare — or a required one the model left out — denies the call. The denial names the mismatch, which a model can act on when it retries.

Requires the `dogwood-aws` package.

Example::

dogwood = DogwoodAuthorization( policies=‘permit(principal, action == Action::“search”, resource);’, tools=\[search\_tool\], ) agent = Agent(model=model, tools=\[search\_tool\], interventions=\[dogwood\])

#### on\_error

```python
@property
def on_error() -> OnError
```

Defined in: [src/strands/vended\_interventions/dogwood/dogwood.py:126](https://github.com/strands-agents/harness-sdk/blob/main/strands-py/src/strands/vended_interventions/dogwood/dogwood.py#L126)

What to do when this handler throws.

#### \_\_init\_\_

```python
def __init__(*,
             policies: str,
             tools: list[AgentTool | ToolSpec] | None = None,
             action_schema: str | None = None,
             entities: list[EntityInput] | None = None,
             namespace: str | None = None,
             principal: EntityRef | None = None,
             principal_resolver: PrincipalResolver | None = None,
             context_enricher: ContextEnricher | None = None,
             on_error: OnError = "throw") -> None
```

Defined in: [src/strands/vended\_interventions/dogwood/dogwood.py:130](https://github.com/strands-agents/harness-sdk/blob/main/strands-py/src/strands/vended_interventions/dogwood/dogwood.py#L130)

Initialize the Dogwood authorization handler.

**Arguments**:

-   `policies` - Dogwood policy text, or a path to a `.dw` file on disk.
    
-   `tools` - Tools the action schema is generated from, as the tools themselves or their specs.
    
-   `action_schema` - Cedar action schema text, or a path to a `.cedarschema` file. Generated from `tools` when omitted. The namespace, the default principal and the resource are read from it, so it must declare its user entity as `User` and its resource entity as `Resource`.
    
-   `entities` - Entities supplied to every decision — attributes and hierarchy a policy reads. Requires `action_schema`: a generated schema declares its entities with no attributes and no membership, so an entity carrying either fails conformance at decision time and denies every call.
    
-   `namespace` - Namespace for a generated action schema, qualifying every action and entity it declares, as in `Acme::Action::"search"` and `Acme::User`. Omit it and they are declared at the top level. Only valid with `tools`.
    
-   `principal` - Static principal, `User::"anonymous"` by default, qualified by the schema’s namespace when it declares one. Against a generated schema the type must be `User`. Mutually exclusive with `principal_resolver`.
    
-   `principal_resolver` - Dynamic principal resolver for multi-tenant agents. Return None to deny (fail-closed). Mutually exclusive with `principal`.
    
-   `context_enricher` - Adds fields to the `session` group of the Cedar request context, read by a policy as `context.session.tenant`, for `invocation_state` values a tool’s arguments do not carry. Dogwood checks a request’s context against the action’s context type, so this requires an `action_schema` declaring `session` on every tool action. The fields reach a `when` condition only, never a temporal predicate.
    
-   `on_error` - What to do when `principal_resolver` or `context_enricher` raises: `'throw'` (default) re-raises, `'deny'` denies the tool call (fail-closed).
    
    **Warning:** `'proceed'` is fail-open — the tool runs with no authorization check. A failed Dogwood decision always denies regardless of this setting.
    

**Raises**:

-   `ValueError` - If neither `action_schema` nor `tools` is supplied, if `principal` and `principal_resolver` are both, if `entities` is non-empty without `action_schema`, if `namespace` is supplied with one or is not a legal Cedar namespace, if `principal` is not of the type a generated schema declares, if `context_enricher` is supplied against a schema that declares no `session` context group, or if the policy set does not type-check against the schema.
-   `DogwoodError` - If the policy set, the schema, or a tool manifest fails to parse.

#### before\_tool\_call

```python
def before_tool_call(event: BeforeToolCallEvent,
                     **kwargs: Any) -> Proceed | Deny
```

Defined in: [src/strands/vended\_interventions/dogwood/dogwood.py:248](https://github.com/strands-agents/harness-sdk/blob/main/strands-py/src/strands/vended_interventions/dogwood/dogwood.py#L248)

Decide a tool call against the policy set, and record the request event.

#### after\_tool\_call

```python
def after_tool_call(event: AfterToolCallEvent, **kwargs: Any) -> Proceed
```

Defined in: [src/strands/vended\_interventions/dogwood/dogwood.py:305](https://github.com/strands-agents/harness-sdk/blob/main/strands-py/src/strands/vended_interventions/dogwood/dogwood.py#L305)

Record the result of a call this handler allowed, so temporal rules can read it.

#### reset

```python
def reset() -> None
```

Defined in: [src/strands/vended\_interventions/dogwood/dogwood.py:346](https://github.com/strands-agents/harness-sdk/blob/main/strands-py/src/strands/vended_interventions/dogwood/dogwood.py#L346)

Drop accumulated temporal history.

Clears every principal this instance has decided for, not one session’s history.