Summary
On the Messages API, a safety refusal is reported via stop_reason="refusal" plus
stop_details (RefusalStopDetails, with category = bio | cyber). The Managed
Agents session event stream appears to have no equivalent, so a consumer can't tell
that a turn ended due to a model refusal (or which category).
Details
Verified against main and the latest release (v0.107.1):
-
BetaManagedAgentsSessionStatusIdleEvent.stop_reason is a union of only
BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted — no refusal variant.
(src/anthropic/types/beta/sessions/beta_managed_agents_session_status_idle_event.py)
-
BetaManagedAgentsSpanModelRequestEndEvent exposes is_error and model_usage
but no stop_reason / stop_details.
(src/anthropic/types/beta/sessions/beta_managed_agents_span_model_request_end_event.py)
For comparison, the Messages API Message carries stop_reason (includes "refusal")
and stop_details (RefusalStopDetails). The BetaStopReason enum also lists
"refusal", but the session-idle event's stop_reason union does not include it.
Initial analysis — needs confirmation
A prompt that triggers a refusal on the Messages API appears, in a Managed Agents
session, to produce a turn with little/no text after which the session goes idle,
with no event field indicating a refusal occurred.
Possible resolution: include a refusal variant in the session.status_idle
stop_reason union, and/or surface the underlying model stop_reason / stop_details
on span.model_request_end.
Summary
On the Messages API, a safety refusal is reported via
stop_reason="refusal"plusstop_details(RefusalStopDetails, withcategory=bio|cyber). The ManagedAgents session event stream appears to have no equivalent, so a consumer can't tell
that a turn ended due to a model refusal (or which category).
Details
Verified against
mainand the latest release (v0.107.1):BetaManagedAgentsSessionStatusIdleEvent.stop_reasonis a union of onlyBetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted— norefusalvariant.(
src/anthropic/types/beta/sessions/beta_managed_agents_session_status_idle_event.py)BetaManagedAgentsSpanModelRequestEndEventexposesis_errorandmodel_usagebut no
stop_reason/stop_details.(
src/anthropic/types/beta/sessions/beta_managed_agents_span_model_request_end_event.py)For comparison, the Messages API
Messagecarriesstop_reason(includes"refusal")and
stop_details(RefusalStopDetails). TheBetaStopReasonenum also lists"refusal", but the session-idle event'sstop_reasonunion does not include it.Initial analysis — needs confirmation
A prompt that triggers a refusal on the Messages API appears, in a Managed Agents
session, to produce a turn with little/no text after which the session goes idle,
with no event field indicating a refusal occurred.
Possible resolution: include a
refusalvariant in thesession.status_idlestop_reasonunion, and/or surface the underlying modelstop_reason/stop_detailson
span.model_request_end.