Responses are the human decisions and feedback that complete the human-in-the-loop workflow. When reviewers examine requests, they provide structured responses that your system can process to continue the workflow.
def validate_response(response): errors = [] # Check required fields if not response.decision: errors.append("Decision is required") if not response.reasoning: errors.append("Reasoning is required") # Validate decision values valid_decisions = ["approved", "rejected", "needs_changes", "escalate"] if response.decision not in valid_decisions: errors.append(f"Invalid decision: {response.decision}") # Check confidence range if response.confidence < 0 or response.confidence > 1: errors.append("Confidence must be between 0 and 1") # Validate processing time if response.processing_time < 0: errors.append("Processing time cannot be negative") return errors