A Policy is a single rule your organization wants enforced on governed calls. Policies live in the EgisAI dashboard — operators create, edit, and target them there. The SDK fetches the active set, caches it locally, and refreshes it continuously without requiring a redeploy of your application.Documentation Index
Fetch the complete documentation index at: https://docs.egisai.co/llms.txt
Use this file to discover all available pages before exploring further.
Where policies live
Policies are configured in the EgisAI dashboard. The dashboard is the source of truth; the SDK consumes the published configuration. You do not embed policy documents in your repository. The SDK works without any extra files.Categories of rules
| Category | Purpose (high level) |
|---|---|
| PII & secrets | Detect and block or mask categories such as government identifiers, payment data, and credential-shaped strings before model calls. |
| Content patterns | Allow or deny prompts or outputs matching operator-defined patterns. |
| Models & size | Restrict which model names may be called, or cap prompt size. |
| Intent | Block requests that match dangerous or out-of-scope intent even when phrased obliquely or in another language. |
| Tools & connectors | Restrict tool, shell, or integration use when the model returns structured tool or command requests. |
Policy targeting
Operators can scope a policy to:- All agents in the org — applies everywhere.
- Specific agents — applies only to the listed agents.
- Agent groups — applies to a named set of agents managed in the dashboard.
Policy refresh
Once active, the SDK keeps your local cache fresh in two ways:- Live updates — when the live update channel is reachable, policy changes propagate to your process within seconds.
- Polling — at the interval set by
refresh_interval_seconds(default10), the SDK polls for updated configuration. This is the fallback for environments that block long-lived connections.
enable_sse=False; the SDK then relies on
polling alone.
Inspecting policies from your code
The SDK exposes its public types so you can integrate policy decisions outside the patched call paths if you need to. The most useful primitives are:| Symbol | Use |
|---|---|
PolicyRule | One active rule. Construct from a list pulled from your own source if needed. |
PolicyContext | The inputs an input-side rule expects (model, prompt, etc). |
OutputPolicyContext | The inputs an output-side rule expects. |
evaluate_policies() | Run input-side rules synchronously. |
evaluate_output_policies() | Run output-side rules synchronously. |
PolicyDecision | Verdict + matched rule records returned by both functions. |
These primitives are deliberately pure-Python. They evaluate locally and do
no I/O, so you can use them inside your own code paths to apply consistent
policy semantics to text outside the patched provider SDKs.
Empty policy sets
If your organization has no enabled policies, every call passes through. The startup banner makes this visible:What’s next
Verdicts
The three outcomes a policy can produce.
API reference
Detailed reference for
PolicyRule, PolicyContext, and PolicyDecision.