Preconditions and Postconditions
Preconditions declare what state MUST be true before an operation can execute. Postconditions declare what state WILL be true after successful execution.
Preconditions
Examples:
cart_validated— The cart must be validated before checkoutuser_authenticated— The user must be logged ininventory_reserved— Inventory must be reserved before payment
Preconditions enable agents to:
- Check whether execution is safe before invoking
- Identify what steps must be completed first
- Plan multi-step workflows automatically
Postconditions
Examples:
checkout_session_created— A checkout session will exist after executionticket_assigned— The ticket will be assigned to an agentorder_confirmed— The order will be in confirmed status
Postconditions enable agents to:
- Verify operation success
- Chain operations by using postconditions as preconditions for subsequent steps
- Report expected outcomes to users
Workflow Chaining
Preconditions and postconditions enable automatic workflow planning:
validate_cart → postcondition: cart_validated
reserve_inventory → precondition: cart_validated → postcondition: inventory_reserved
begin_checkout → precondition: cart_validated, inventory_reserved → postcondition: checkout_session_created
An agent can automatically determine the correct execution order.