Basic usage
search_web(...) will:
- Measure duration
- Record inputs/outputs
- Append a ledger entry
Async functions
Exceptions
Agent Sentinel does not swallow your exceptions. If your function raises, the exception propagates normally — the SDK records the action asoutcome="error" and logs the error string.
Fail-open vs fail-closed
- Fail-open: ledger writes and remote sync should never crash your agent.
- Fail-closed: policy violations intentionally raise before execution (see Policies).
Decorator arguments
@guarded_action accepts the following keyword-only arguments. Anything beyond name, cost_usd, and tags is optional — sensible defaults apply.
| Argument | Type | Purpose |
|---|---|---|
name | str | Logical action name (defaults to function name) |
cost_usd | float | Estimated per-call cost; deducted from budgets |
tags | list[str] | Free-form tags; matched against policy approval_tags |
requires_human_approval | bool | Pause and request human approval before execution |
approval_description | str | Human-readable description shown in the approval inbox |
agent_id / task_id / mission_id | str | Attribution overrides; default to current ExecutionContext |
produces_evidence | bool | Mark this action as producing evidence other actions can require |
is_commit | bool | Mark as a commit action (subject to evidence + grounding checks) |
requires | list[str] | Names of evidence actions that must precede this one |
argument_constraints | dict | JSON Schema applied to kwargs before execution |
evidence_max_age_seconds | int | Maximum age of required evidence before it expires |
grounding_rules | dict | Field-level grounding constraints (action arg → evidence field) |
risk_level | str | One of critical, high, medium, low, minimal |
idempotency_key | str | Callable | Static key or (args, kwargs) -> key callable for replay caching |
idempotency_ttl_seconds | float | TTL for the cached result (default 3600s) |
Replay mode integration
If replay mode is active, decorated actions return recorded outputs instead of executing (and are logged withoutcome="replayed").
See Replay.