Skip to main content

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.

The egisai SDK governs every supported LLM call without changing your calling convention. Once egisai.init() runs, supported provider SDKs are patched in place and each call goes through the same lifecycle.

The call path

1

Your code calls the provider

Your code makes an ordinary call — client.chat.completions.create(...), client.messages.create(...), model.generate_content(...), etc. There are no wrapper objects to remember.
2

The SDK applies your active policies

Before the upstream model runs, the SDK applies your organization’s active policies (cached locally and refreshed continuously). Rules such as PII detection, regex denylists, model allowlists, prompt-size caps, and intent-oriented checks are evaluated in a fixed order defined by the product. See Policies.
3

A verdict is computed

Each call resolves to one of three outcomes:
  • Allow — forwarded to the provider as-is.
  • Sanitize — sensitive values are masked locally, then the cleaned payload is forwarded.
  • Block — the call is refused. Depending on configuration the SDK raises PermissionError or returns a framework-shaped refusal object.
See Verdicts for the full picture.
4

The provider call runs (or doesn't)

On allow or sanitize the patched method delegates to the original provider SDK using the (possibly cleaned) payload. Blocked calls never reach the provider.
5

An audit event is emitted

A structured event describing the verdict, matched rules, latency, and usage is delivered asynchronously so it never sits on the critical path of your model call. The result is visible on the dashboard within seconds.

Two-phase evaluation

Policy evaluation happens in two clearly separated phases.

Phase 1 — Local checks

Deterministic rules that run entirely inside your process. PII pattern detection, regex denylists, prompt-size caps, and model allow-lists fall in this phase. Raw prompt content never leaves your environment as part of these checks.

Phase 2 — Intent checks

Rules that involve a judge are run only after Phase 1 finishes. If Phase 1 sanitized the prompt, Phase 2 sees the cleaned text — never the original sensitive values.
If Phase 1 already blocks the call, Phase 2 is skipped entirely. The verdict precedence across all matches is block > sanitize > allow.

What is governed

The SDK governs supported provider SDKs in-process:
  • openai — Chat Completions, Responses API, streaming variants.
  • anthropic — Messages API, streaming variants.
  • google-generativeaiGenerativeModel.generate_content, streaming variants.
  • httpx / requests — optional broad HTTP capture for libraries that don’t go through one of the official SDKs above.
See Integrations for the per-provider walkthrough.

Steady-state cost

After the first call for a given identity, every subsequent call is a dictionary lookup. The SDK is designed so that policy evaluation adds on the order of a fraction of a millisecond per call after warm-up. Audit delivery is asynchronous; latency to EgisAI does not block your provider call.

Failure modes

The SDK is built to fail open on availability and fail closed on PII.
SituationBehavior
Control plane unreachable at startupThe SDK runs in a degraded mode and logs a warning. Local checks remain in force where the engine can evaluate them. The user’s provider call still proceeds.
Local PII engine errors mid-evaluationThe call is treated as if PII was detected — better to over-block than to leak regulated values.
Audit delivery temporarily failsEvents are retried asynchronously; user-facing call latency is unaffected.
For your specific deployment’s behavior, see your contract and the SECURITY document.

What’s next

Verdicts

Allow, sanitize, and block — what each one means in detail.

Agents

How the SDK identifies which agent made each call.

Policies

Categories of rules and where they’re configured.

Blocking behavior

Choose between raise and stub modes.