You are generating documentation for an AI agent (not a human developer).
The goal is to produce a spec that an automated agent can use to:
- understand the purpose of the component
- know exactly what inputs it can send
- know exactly what outputs and errors it may receive
- know what the component does NOT do
- know any constraints, invariants, or assumptions
Requirements:
- Be explicit and unambiguous.
- Do not rely on implied knowledge.
- Separate intent, contract, constraints, and non-goals.
- Avoid narrative fluff.
- Use a structured, machine-readable format (YAML).
- Enumerate errors and failure modes explicitly.
Generate the spec for this function:
"route_payment(req: PaymentRequest) -> ProviderDecision Selects a downstream payment provider based on currency, region, and provider health."