Agent Decorator — Policy Per Agent
The@cascadeflow.agent() decorator attaches policy metadata directly to agent functions. Each agent gets its own budget, compliance rules, and KPI weights — enforced automatically at runtime.
Basic Usage
Add Compliance
Add KPI Weights
Encode business priorities into how the agent makes model decisions:Different Agents, Different Policies
The real power shows with multiple agents — each governed independently:Combine with run()
The decorator works alongsidecascadeflow.run() — the run’s constraints apply in addition to the decorator’s:
All Decorator Parameters
| Parameter | Type | Description |
|---|---|---|
budget | float | Max USD for this agent |
compliance | str | "gdpr", "hipaa", "pci", or "strict" |
kpi_weights | dict | Relative weights: quality, cost, latency, energy |
kpi_targets | dict | Target values per KPI dimension |
max_tool_calls | int | Max tool/function calls per invocation |