Skip to main content
Agents — called personas in the API — configure how Hadiq.io responds to users. Each agent can have a custom system prompt, access to specific document sets, and a set of enabled tools. Agents are the persona_id you pass when creating a chat session.

Create an agent

Creates a new agent. Any authenticated user with basic access can create agents.

Request body

string
required
Display name for the agent.
string
required
Short description shown in the agent picker UI.
string
required
The system prompt injected before every conversation. Use this to set tone, persona, constraints, and capabilities.
string
required
Additional task-level instructions appended to the system prompt.
boolean
required
When true, injects the current date and time into the system prompt.
boolean
default:"false"
When true, the system_prompt fully replaces the default Onyx base system prompt instead of prepending to it.
boolean
required
When true, the agent is visible to all users in your tenant.
array
required
IDs of document sets this agent searches. Pass an empty array for a general-purpose agent with no scoped knowledge.
array
required
IDs of tools enabled for this agent (e.g. search tool, image generation tool). Pass an empty array to disable tools.
string
Override the LLM provider (e.g. openai, anthropic).
string
Override the model version (e.g. gpt-4o, claude-3-5-sonnet-20241022).
array
Suggested starter prompts shown to users when opening a new chat with this agent.
array
UUIDs of users who can access this agent when is_public is false.
array
Group IDs that can access this agent when is_public is false.
string (ISO 8601)
Only search documents updated after this date.
array
Label IDs to tag this agent with for organization.
Feature this agent prominently in the UI.
integer
Sort order in the agent list. Lower values appear first.
array
IDs of hierarchy nodes (folders, spaces, channels) to scope search to.
array
IDs of individual documents to attach for scoped search.
array
IDs of user-uploaded files to attach.

Response

Returns a PersonaSnapshot with the created agent’s full details.
integer
Unique agent ID. Use this as persona_id when creating chat sessions.
string
Agent name.
string
Agent description.
boolean
Whether the agent is publicly visible.
boolean
Whether this is a built-in Hadiq.io agent (cannot be deleted).
array
Tools enabled for this agent.
array
Document sets this agent searches.
string
The agent’s system prompt.

Update an agent

Updates an existing agent. Accepts the same fields as the create request. You can only update agents you own or have edit access to.
This endpoint cannot update display_priority or builtin_persona. Use the admin display-priority endpoint to reorder agents.

Path parameters

integer
required
ID of the agent to update.

Request body

Same as create an agent. All fields may be updated.

Get an agent

Returns the full details of a single agent.

Path parameters

integer
required
The agent to retrieve.

Response

Returns a FullPersonaSnapshot, which extends PersonaSnapshot with search_start_date.

List agents

Returns a paginated list of agents available to the authenticated user.

Query parameters

integer
default:"0"
Page number (0-indexed).
integer
default:"10"
Items per page. Maximum 1000.
boolean
default:"false"
Include soft-deleted agents.
boolean
default:"false"
When true, only returns agents you can edit.
boolean
default:"true"
Include the built-in default agents.

Response

array
Page of MinimalPersonaSnapshot objects.
integer
Total number of agents matching the query.

Delete an agent

Soft-deletes an agent. The agent is hidden from users but its data is retained. You can only delete agents you own.

Path parameters

integer
required
The agent to delete.
Returns 204 No Content on success.

Admin: list agents (paginated)

Admin version of the agents list endpoint, with the same query parameters as GET /api/agents. Returns PersonaSnapshot objects (more detailed than MinimalPersonaSnapshot). Requires admin or curator role.

Error codes