Agent outcome reason codes¶
openmed.agent.outcomes gives agent workflows a small, closed vocabulary for what happened. The payload is metadata only: a class, a reason code, and a schema version. It does not store prompts, tool arguments, tool outputs, evidence text, paths, or credentials.
The public API distinguishes:
successwithcompletedabstainedwithinsufficient_evidence,out_of_scope, orlow_confidencereview_requiredwithconflicting_evidence,safety_review, orhuman_gatepolicy_deniedwithconsent_required,purpose_mismatch, orphi_policyfailedwithtool_error,timeout, orinvalid_input
Unknown classes, unknown reason codes, class/reason mismatches, extra fields, and free-text reasons fail closed. Exception messages name the field or a stable error code and do not echo the submitted value.
from openmed.agent import WorkflowOutcome
outcome = WorkflowOutcome.from_dict(
{
"outcome_class": "abstained",
"reason_code": "insufficient_evidence",
}
)
payload = outcome.to_json()
to_dict() emits fields in a stable order. to_json() emits compact JSON with sorted keys so identical inputs serialize byte-for-byte identically.
This module does not execute tools, persist run logs, or decide clinical actions.