Back to Prompt Library
planning
Define Pydantic Models for Policy & Compliance
Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.
Linked challenge: Global Compliance Intelligence Agent
Format
Code-aware
Lines
17
Sections
5
Linked challenge
Global Compliance Intelligence Agent
Prompt source
Original prompt text with formatting preserved for inspection.
17 lines
5 sections
No variables
1 code block
Begin by defining several Pydantic models that will represent the structured data your agent will extract and generate. Create a `TaxExemptionPolicy` model with fields like `entity_type`, `exemption_type`, `scope`, `conditions`, and `valid_until`. Also, define a `ComplianceReport` model that includes `compliance_status`, `recommendations`, and `relevant_clauses`. These models will guide your agent's output and validation logic.
```python
from pydantic import BaseModel, Field, conlist
from typing import Optional
class TaxExemptionPolicy(BaseModel):
entity_type: str = Field(..., description='Type of entity eligible for exemption (e.g., foreign_cloud_provider)')
exemption_type: str = Field(..., description='Type of tax exemption (e.g., income_tax, import_duty)')
scope: str = Field(..., description='Specific scope of the exemption (e.g., services_sold_outside_india)')
conditions: conlist(str, min_length=1) = Field(..., description='List of conditions that must be met for the exemption')
valid_until: Optional[int] = Field(None, description='Year until which the exemption is valid, if applicable')
class ComplianceReport(BaseModel):
compliance_status: str = Field(..., description='Overall compliance status (e.g., Compliant, Non-Compliant, Conditional)')
recommendations: conlist(str, min_length=1) = Field(..., description='Actionable recommendations for ensuring compliance')
relevant_clauses: conlist(str, min_length=1) = Field(..., description='List of relevant policy clauses or sections')
print(TaxExemptionPolicy.model_json_schema())
print(ComplianceReport.model_json_schema())
```Adaptation plan
Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.
Keep stable
Preserve the role framing, objective, and reporting structure so comparison runs stay coherent.
Tune next
Swap in your own domain constraints, anomaly thresholds, and examples before you branch variants.
Verify after
Check whether the prompt asks for the right evidence, confidence signal, and escalation path.