resolve_interventions (strands_harness/interventions.py)

sdk-python · harness-py/src/strands_harness/interventions.py · python · Apache-2.0
ai, AI / Agents

Converts harness intervention sugar into SDK intervention handlers, handling presets and policies.

# Source: https://github.com/strands-agents/harness-sdk | License: Apache-2.0
# Provided via justclaw.it.com; keep this notice with the code.
"""Resolve the harness's ``interventions`` sugar into SDK intervention handlers.

The harness's ``interventions`` option accepts a preset name, a natural-language policy, a Cedar policy
file, an SDK handler instance, or a list of these, and coerces them into the handlers that
``Agent(interventions=...)`` expects. A raw handler instance passes through untouched, so anything
the presets don't cover (a Slack ``ask`` callback, a Cedar principal resolver, custom trust rules)
stays reachable by constructing the SDK handler yourself.

The string grammar is deterministic — no content sniffing:

- a preset keyword (``off``/``ask``/``smart``) maps to a ``Human

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key