API Reference
AIGuard exposes both a Typer-based CLI and a small Python SDK.
CLI
| Command | Purpose |
|---|---|
aiguard project init | Create aiguard.yaml in the current directory. |
aiguard evaluate | Run all enabled evaluation modules. |
aiguard evaluate adversarial | Run adversarial attack suite only. |
aiguard evaluate hallucination | Run hallucination detection only. |
aiguard monitor | Start the monitoring API + UI. |
aiguard pipeline | Start the background evaluation pipeline. |
aiguard dev | Start pipeline + monitoring API + UI together. |
aiguard review serve | Start the human review server. |
aiguard storage migrate | Apply pending storage migrations. |
aiguard ci github | Print a GitHub Actions workflow. |
aiguard ci gitlab | Print a GitLab CI configuration. |
SDK
aiguard.configure(...)
One-time configuration. Optional — the SDK auto-reads aiguard.yaml.
python
aiguard.configure(
sampling_rate=1.0, # 0.0 – 1.0
queue_max_size=10_000,
project="my-project",
)aiguard.chat(...)
Drop-in wrapper around litellm.completion.
python
response = aiguard.chat(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
metadata={"feature": "chat-ui"},
)
# Returns the original litellm response unmodified.TraceEvent
Dataclass passed to every trace handler. Key fields:
trace_id: strtimestamp: datetimemodel: strinput: list[Message]output: Messagelatency_ms: inttokens: TokenUsagemetadata: dict