AI Agents — Administrator Guide

Audience: System administrators, Agent Administrators, and AI Auditors. Use this document when: You configure LLM providers, model configurations, tools, agents, versions, permissions, document intelligence, audit, or AI settings. Canonical for: AI configuration, publishing, permissions, audit, and settings. Related: AI Agents Index, End User Guide, Custom Template Guide, Report Design Recommendations, Document Processing.

This guide is the canonical reference for the enezaagents app. It describes the screens under the Agents menu and the settings that control the AI subsystem.

Roles and permissions

AI access is controlled by the framework's role-based access control. A user needs both the AI permission and the normal model or module permission.

Role or privilege What it grants
SYSTEM_ADMINISTRATOR Administration functions, including the administrator AI Insights dashboard.
AGENT_ADMINISTRATOR Configure and publish agents, versions, tools, sub-agents, providers, model configurations, document schemas, and document templates. Includes function.agents.use, function.agents.admin, and function.agents_admin.admin.
AI_AUDITOR AI audit access through function.agents_audit.admin, including the auditor AI Insights dashboard.
function.agents.use AI Workspace, contextual assistant, proposed-action runtime, and read-only access to agent runs and artifacts. Linked to the User role.
function.agents.admin Agent configuration and administration.
function.agents_admin.admin Agent administration setup screens.
function.agents_audit.admin Audit screens and audit insights.

AI action codes registered by the app:

Action code Purpose
action.enezaagents.assistant Use contextual AI assistant.
action.enezaagents.workspace Use AI Workspace.
action.enezaagents.action_apply Apply AI proposed actions.
action.enezaagents.insights_auditor View AI audit insights.
action.enezaagents.insights_admin View AI admin insights.

A non-built-in agent is also checked against action.enezaagents.agent.<agent_code> and every permission in the agent's Required Permissions field. Confirm that the matching grant exists in your RBAC configuration before rollout. Built-in agents check their required permissions. Contextual and default agents are available without the per-agent action grant.

Setup order

Configure the subsystem in this order. Each step depends on the previous one.

  1. Create an LLM Provider under Agents › LLM Providers.
  2. Create a Model Configuration under Agents › Model Configurations.
  3. Review or create Tools under Agents › Tools.
  4. Create an Agent under Agents › Agents.
  5. Create a draft Agent Version with instructions and a model configuration.
  6. Attach tools and sub-agents to the version.
  7. Publish the agent from the agent detail screen.
  8. Verify availability for the intended users and pages.
  9. Optionally configure Document Schemas and Document Templates.

Do not skip the model configuration step. An agent version without a usable model configuration cannot run.

LLM Provider

Open Agents › LLM Providers and create or edit a provider.

Field Required What it means
Name Yes Human-readable provider name.
Code Yes Stable code used by the system. Must be unique per entity.
Provider Type Yes OPENAI, OPENAI_COMPATIBLE, DEEPSEEK, ANTHROPIC, ANTHROPIC_COMPATIBLE, or OPENROUTER.
Base URL Conditional Required for OPENAI_COMPATIBLE and ANTHROPIC_COMPATIBLE. Common providers have a built-in default.
API Key No Stored encrypted and shown as a masked, write-only field.
API Key Environment Variable No When set, this environment variable takes precedence over the stored key.
Timeout Seconds Yes Request timeout. Default 60.
Max Retries Yes Provider retry count. Default 2.
Description No Administrative note.
Enabled Yes Disabled providers cannot be used.
Is Default No Marks the shared default provider. Setting one default clears the previous shared default.

API key resolution order:

  1. The environment variable named in API Key Environment Variable.
  2. The encrypted key stored on the provider.
  3. The standard environment variable for the provider type, such as OPENAI_API_KEY, DEEPSEEK_API_KEY, ANTHROPIC_API_KEY, or OPENROUTER_API_KEY.

Never store a real key in documentation, source control, or a description field.

Model Configuration

Open Agents › Model Configurations and create or edit a model.

Field Required What it means
Provider Yes The LLM Provider used by this model.
Model Name Yes Provider model identifier, for example gpt-4o-mini.
Display Name No Friendly name shown in screens.
API Flavor Yes CHAT for Chat Completions or RESPONSES for the provider's Responses API.
Description No Administrative note.
Temperature Yes Sampling temperature. Default 0.2.
Max Tokens No Maximum output tokens. Leave blank for the provider default.
Max Iterations Yes Maximum agent loop iterations. Default 20.
Context Window No Model context limit when known.
Supports Tools Yes Whether the model can call tools.
Supports Structured Output Yes Whether the model can return structured output.
Supports Streaming Yes Whether the model can stream responses.
Supports Native Web Search Yes Whether the provider can perform native web search.
Input Cost per 1M Tokens No Cost used for usage reporting.
Output Cost per 1M Tokens No Cost used for usage reporting.
Currency Yes Currency for cost reporting. Default USD.
Enabled Yes Disabled models cannot be used.
Is Default No Marks the shared default model. Setting one default clears the previous shared default.

ai_seed_models can create common provider and model defaults. ai_set_default_model can mark a shared provider and model as the default and repoint shared agent versions to it.

Tools

Open Agents › Tools. Built-in tools are seeded by the app. Developer and REST tools are optional.

Field Required What it means
Name Yes Human-readable tool name.
Code Yes Stable tool code used by agents and the runtime.
Tool Type Yes BUILTIN, DEVELOPER, or REST_API.
Category Yes METADATA, QUERY, RECORD, BUSINESS_ACTION, WORKFLOW, DOCUMENT, WEB, TASK, or UTILITY.
Description No LLM-facing explanation of when to use the tool.
Handler Conditional Built-in tool code or dotted callable for a developer tool.
Endpoint URL Conditional Required for a REST API tool.
HTTP Method Conditional GET or POST for a REST API tool.
Headers No One Key: Value per line. Values support ${ENV_VAR} expansion.
Input Schema No JSON Schema for the tool arguments.
Output Schema No JSON Schema for the tool result.
Required Permissions No Permissions the user must hold before the tool runs.
Execution Policy Yes AUTOMATIC, CONFIRMATION_REQUIRED, APPROVAL_REQUIRED, or DISABLED.
Confirmation Policy Yes Confirmation behavior for the tool.
Audit Enabled Yes Records tool activity in the audit trail.
Is Built-in Yes Marks a framework-provided tool.
Enabled Yes Disabled tools are not available to agents.

External tools are blocked by default. To allow DEVELOPER or REST_API tools, set AI_ALLOW_EXTERNAL_TOOLS=True in the project settings. A REST API tool also requires an endpoint URL.

Agents

Open Agents › Agents and create an agent.

Field Required What it means
Name Yes Human-readable agent name.
Code Yes Stable code. Must be unique per entity.
Application No Application label the agent belongs to, such as humanresource.
Module No Module or model name the agent belongs to.
Description No What the agent does. Shown in agent pickers.
Required Permissions No Permission codes a user must hold before the agent is available.
Is Contextual No Marks an agent used by contextual pages rather than the workspace.
Is Default No Marks a default agent that is available without a per-agent action grant.
Max Steps Yes Maximum steps for the agent. Default 20.
Token Limit No Optional token budget.
Cost Limit No Optional cost budget.
Status Yes DRAFT, PUBLISHED, or ARCHIVED.

Setting Application and Module helps the runtime record usage and helps users find the right agent. It does not by itself attach the agent to a page.

Agent Versions and publishing

Open an agent and create or edit its version. A version holds the runnable configuration.

Field Required What it means
Agent Yes The parent agent.
Version Auto Assigned when the version is created.
Version Status Yes DRAFT, PUBLISHED, or ARCHIVED.
Instructions Recommended The agent's system instructions. Write clear scope, tools to prefer, and refusal rules.
Model Configuration No The model used by the version. A runnable version needs a usable configuration.
Output Schema No Optional structured output schema.
Is Latest Auto Marks the latest published version.

Publishing rules:

  • Only the latest published version is runnable.
  • Publishing snapshots the working version's instructions, model configuration, output schema, required permissions, provider snapshot, tools, and sub-agents.
  • Editing a draft does not change the running agent.
  • Publishing again creates the next version number and marks it as latest.
  • Archived versions are not runnable.
  • A published snapshot is self-contained: later changes to a tool or sub-agent do not change the published version until you publish again.

Publish from the agent detail screen with the Publish action. Confirm the new version number and that the agent status is Published.

Tools and sub-agents on a version

Model Fields Meaning
Agent Version Tool agent_version, tool, enabled, configuration Assigns one tool to one version. Disabled rows are ignored.
Agent Version Sub-Agent parent_version, child_agent, role, configuration Delegates work from a parent version to another agent. The role and configuration describe the delegated scope.

Attach only the tools the agent needs. Each tool is also checked against the user's permissions and the tool's execution policy at run time.

Built-in agents

The framework provisions several built-in agents. ai_seed_tools ensures the Workspace Orchestrator, the Contextual Assistant, and the builder agents exist. The AI Workspace also ensures the orchestrator and builder agents when it loads.

Agent code Where it is used Required permission
contextual_assistant Ask assistant on list and detail pages. action.enezaagents.assistant and model view access.
workspace_orchestrator The permanent AI Workspace coordinator. action.enezaagents.workspace.
dashboard_builder Ask assistant on All dashboards, module dashboard lists, and dashboard detail pages. action.enezadashboard.manage.
report_builder Ask assistant on report list, create, edit, and designer pages. Report create or edit permissions, depending on the page.
followup_assistant Follow-up tasks and calendar events from records. action.enezacommon.tasks and action.enezaadminstrator.calendar.
records_agent Authorized record creation with review. The user's model create access and the agent's required permissions.

Notes:

  • dashboard_builder creates a dashboard draft only. It never publishes, edits, archives, or deletes an existing dashboard.
  • report_builder creates a report draft or design recommendation only. It does not publish.
  • The report designer is a page-specific mode of the report page assistant. It proposes changes to the saved report that is open; the user must apply them. See Report Design Recommendations.
  • Built-in instructions and tools are code-managed. python manage.py ai_seed_tools can overwrite local edits to a built-in agent's instructions or tool list. Do not rely on local edits to built-in instructions.
  • The Dashboard Builder uses seeded sample dashboards and dashboard report sources. If a module has no accessible dashboard report source, the agent cannot create a draft for that module.

For dashboard-builder behavior, tools, page contexts, and troubleshooting, see Dashboard Builder.

Document intelligence

Document intelligence parses record attachments and AI Workspace uploads, classifies them, extracts structured data against versioned schemas, analyses them against versioned templates, and records every operation as a document processing job with evidence.

Open Agents › Document Schemas and Agents › Document Templates to configure the definitions.

  • Defining a schema or template only makes it eligible. A job must pass a code, a target model or category, or a pinned reference before it is used.
  • Creating a row with an existing code assigns the next version. Mark older versions inactive to retire them.

For the field reference, selection rules, operation and tool behavior, job statuses, evidence, permissions, settings, and troubleshooting, see Document Processing.

Document jobs are recorded under Agents › AI Audit › Document Jobs and are read-only.

AI Audit and AI Insights

AI Audit

Open Agents › AI Audit.

Screen What it shows
Conversations AI conversations and their context.
Messages User, assistant, and tool messages.
Runs Agent runs, status, provider, model, tokens, duration, and cost.
Document Jobs Document processing jobs, results, errors, warnings, and evidence.
Audit Log Append-only AI audit events.

Audit screens are read-only. AI activity models require the AI Auditor role for wider access. Normal users see only their own activity in normal screens.

AI Insights

Agents › AI Insights opens the module dashboard. Seeded dashboards:

Dashboard code Scope
agent_usage_personal The signed-in user's runs, success and failure, tokens, latency, and trends.
agent_usage_auditor Entity-wide usage, top users, affected modules, documents, and audit events. Requires the AI Auditor role.
agent_usage_admin Entity-wide usage and cost by user, model, module, and time. Requires the System Administrator role.

Environment settings

These settings are read from the project environment or project settings. Defaults are shown where the framework defines one.

Setting Default Purpose
AI_ENABLED True Enables AI discovery and runtime features.
AI_QUERY_MAX_ROWS 100 Maximum rows returned by an AI query.
AI_MAX_STEPS 20 Default maximum agent steps.
AI_MAX_RETRIES 3 Default retry count.
AI_TOOL_CALLS_LIMIT 60 Maximum tool calls per run.
AI_RETENTION_DAYS 90 Default retention for conversations, messages, and audit rows.
AI_LOG_PROMPTS False Include prompt and result payloads in audit records. Enable only when required and permitted.
AI_TASK_QUEUE ai_tasks Background queue for AI tasks.
AI_WEB_SEARCH_BACKEND provider_native Web search backend.
AI_WEB_SEARCH_API_KEY_ENV TAVILY_API_KEY Environment variable for the fallback web search key.
AI_WEB_FETCH_ALLOWED_DOMAINS Empty Comma-separated allowlist for web fetch.
AI_WEB_FETCH_MAX_BYTES 2000000 Maximum fetched response size.
AI_COST_INPUT_PER_1M 0 Fallback input cost per million tokens.
AI_COST_OUTPUT_PER_1M 0 Fallback output cost per million tokens.
AI_COST_CURRENCY USD Cost currency.
AI_ALLOW_EXTERNAL_TOOLS False Allows DEVELOPER and REST_API tools.
AI_BUSINESS_REPORT_ENABLED True Adds the business communication policy and report structure to answers.
AI_AUDITOR_ALLOW_SUPERUSER False Allows superusers to access auditor views without the AI Auditor role.
DOCUMENT_INTELLIGENCE_MAX_FILE_BYTES 25 MB Maximum upload size.
DOCUMENT_INTELLIGENCE_MAX_PAGES 500 Maximum pages per document.
DOCUMENT_INTELLIGENCE_MAX_CHARS 2000000 Maximum extracted characters.
DOCUMENT_INTELLIGENCE_MAX_DOCUMENTS_PER_JOB 10 Maximum documents per job.
DOCUMENT_INTELLIGENCE_INLINE_MAX_BYTES 5 MB Maximum inline document size.
DOCUMENT_INTELLIGENCE_INLINE_MAX_PAGES 50 Maximum inline pages.
DOCUMENT_INTELLIGENCE_OCR_ENABLED True Enables OCR for scanned documents.
DOCUMENT_INTELLIGENCE_OCR_BACKEND Auto OCR backend Dotted path to the OCR backend.
DOCUMENT_INTELLIGENCE_CHUNK_SIZE Framework default Document chunk size.
DOCUMENT_INTELLIGENCE_CHUNK_OVERLAP Framework default Chunk overlap.
DOCUMENT_INTELLIGENCE_RETRIEVAL_TOP_K Framework default Retrieval result count.
DOCUMENT_INTELLIGENCE_PARSE_CACHE Framework default Enables parse caching.
DOCUMENT_INTELLIGENCE_TEMPORARY_RETENTION_DAYS Framework default Retention for temporary documents.

Management commands

Run these commands after installation or upgrade when the matching data is needed.

Command Purpose
python manage.py ai_seed_tools Create or update the built-in tool catalogue and ensure built-in agents exist. --reset overwrites local catalogue edits.
python manage.py ai_seed_models Create or update common providers and their default model configurations.
python manage.py ai_set_default_model --provider <code> [--model <name>] Mark a shared provider and model as the default and repoint shared agent versions.
python manage.py ai_sync_registry [--app <label>] [--dry-run] Discover <app>.ai registrations and persist models, field policies, relationships, business actions, and code-registered agents. --app limits model processing to one app label.
python manage.py ai_backfill_run_metrics [--dry-run] Backfill user, module, application, date, tokens, duration, and cost on existing runs.
python manage.py ai_purge_history [--days <n>] Delete conversations, messages, and audit rows older than the retention period.
python manage.py ai_record_history <model_label> <record_id> Print a record, workflow approvals, and audit history for diagnosis.
python manage.py ai_encrypt_provider_keys [--dry-run] Encrypt any plaintext provider keys stored in the database.
python manage.py seed_document_intelligence Seed document intelligence configuration.
python manage.py purge_document_intelligence Remove document intelligence data. Review the command output before running it in production.
python manage.py rbac_bootstrap [--reset-functional] Seed roles and functional privileges, including the AI roles.
python manage.py seed_dashboards --module enezaagents Seed the AI Insights dashboards.

Worker queues

AI tasks are queued on the queue named by AI_TASK_QUEUE. The default is ai_tasks.

Confirm that at least one running background worker consumes that queue. If no worker consumes the AI queue, workspace tasks stay queued and document jobs do not complete.

The project task configuration includes these queues:

python
TASKS = {
    "default": {
        "BACKEND": "django_tasks_db.DatabaseBackend",
        "QUEUES": ["default", "workflow_tasks", "ai_tasks"],
    }
}

Security rules

  • The language model is never an authorization authority.
  • Every query uses the signed-in user's RBAC grants, entity scope, and record scope.
  • The AI does not execute arbitrary SQL, arbitrary Python, or arbitrary ORM field paths from model output.
  • System-managed fields, workflow status fields, audit fields, and entity fields are not writable by AI proposals.
  • Proposed changes require confirmation and are revalidated when applied.
  • API keys and sensitive fields are redacted from audit and user-facing output.
  • Document text, tables, OCR output, and retrieved web content are untrusted data, not instructions.
  • The AI must not create users, invite users, change roles, change privileges, or change administrator flags.
  • The AI must not name inaccessible applications or models, or confirm that restricted data exists.
  • The AI must not reveal another user's activity or attribution.

Troubleshooting

Problem What to check
No model can run A shared provider and model configuration exist, the provider has a usable key, and the model is enabled.
Provider key is rejected Check the environment variable named in API Key Environment Variable, then the stored encrypted key, then the standard provider environment variable.
An agent is missing from the workspace The agent is published, has a latest published version, is not contextual, and the user passes the agent's permissions.
An agent runs an old configuration A new version was not published, or the published snapshot still points to the old model, tools, or sub-agents.
A tool is ignored The tool is disabled, not attached to the published version, blocked by AI_ALLOW_EXTERNAL_TOOLS, or the user lacks its required permissions.
A document job fails The file format, size, page count, OCR backend, or model configuration may be unsupported. Review the job errors and warnings.
A task stays queued No worker consumes the queue named by AI_TASK_QUEUE.
A normal user sees no AI The user lacks function.agents.use, the relevant AI action, or the normal model or menu permission.
Audit data is missing Check AI_LOG_PROMPTS, retention, and whether the audit tables have been purged.
The dashboard is empty Run ai_backfill_run_metrics and seed_dashboards --module enezaagents, then confirm the user's role.
The Dashboard Builder has no source The module needs an accessible dashboard report source and the user needs its output permission. See Dashboard Builder.
A dashboard draft is not live The Dashboard Builder creates a draft only. Publish it in the dashboard designer.
The Dashboard Builder ignores a safe edit Built-in instructions and tools are code-managed and may be overwritten by ai_seed_tools.
Report design recommendation is missing Confirm the report tools were seeded with ai_seed_tools and the user has the report create or edit permission. See Report Design Recommendations.

A note on testing

Per project rules, the developer or agent does not run or claim test results. The user is solely responsible for all testing and validation of the configuration described in this guide.