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.

An Agent is a logical actor that issues governed calls — a customer support bot, an internal coding assistant, a sub-routine of a larger orchestrator. Every governed call is attributed to exactly one Agent on the dashboard so you can review activity, scope policies, and report on usage.

The default attribution

When you call egisai.init(app="customer-support-bot"), that name becomes the default Agent for the process. Unless overridden, every governed call is attributed to it. Agents are auto-created in your organization on first sight — if no Agent with that name exists, the SDK registers one for you and the dashboard’s Agents page updates live. There is no manual onboarding step.
import egisai

egisai.init(app="customer-support-bot", env="production")
This produces an Agent visible at Dashboard → Agents named customer-support-bot.

Sub-agents and per-call identity

Real applications often have several distinct flows running inside the same process — a triage agent, a billing agent, a coding agent. To attribute calls to a sub-agent without re-initializing the SDK, use egisai.set_context():
import egisai

egisai.init(app="orchestrator", env="production")

# Inside one of your handlers
egisai.set_context(agent="billing-agent", user_id="u_123")

response = client.chat.completions.create(...)
# Attributed to "billing-agent" rather than "orchestrator".
set_context() writes to a per-task context variable, so async tasks and threads inherit the value cleanly without leaking across requests. The first time the SDK sees a new agent name it registers it with the platform; subsequent calls are a cache hit. See the set_context reference for every parameter and Multi-agent context for end-to-end patterns.

Resolution precedence

When attributing a call, the SDK uses the first identity it finds in this order:
  1. An explicit agent_id on the active context (from set_context(agent_id=...)).
  2. An explicit agent name on the active context (from set_context(agent=...)).
  3. A system-prompt fingerprint matching a known sub-agent profile.
  4. The process-level default (app from egisai.init()).
Explicit calls always win over auto-detection — you never lose the ability to override.

Why the system prompt matters

When two calls share a system prompt, they almost certainly come from the same logical agent. The SDK fingerprints the system prompt of each call and uses that to keep distinct agents distinct on the dashboard, even when the operator hasn’t set an explicit set_context(agent=...) for them. This means:
  • Two helpers in the same process with different system prompts show up as two Agents.
  • Restarting your process keeps the same fingerprints, so historical activity joins up correctly.
You can opt out of fingerprinting on a per-call basis by setting set_context(agent=...) to a friendly name; the explicit value wins.

Multi-tenant attribution

If you serve multiple end-customers from a single deployment, attach the end-customer identity per request using set_context(user_id=..., session_id=...). Those fields land on each audit event for the lifetime of the context and do not affect agent attribution.
egisai.set_context(
    agent="customer-support-bot",
    user_id=request.user.id,
    session_id=request.session_id,
)

What’s next

Multi-agent context

Patterns for distinguishing several agents in one process.

set_context reference

Every accepted parameter and what it sets.