MngAddAIAgent¶
POST ai/agent
Creates an agent: which model answers, with what instructions, which tools it may use and how much it may spend per day. The brand comes from the session.
Access Control¶
Allowed: admin. global: true is accepted from a super administrator only.
Request¶
POST request
POST https://{broker_domain}/ai/agent
Authorization: <JWT_TOKEN>
Content-Type: application/json
{
"name": "Client assistant",
"model": "anthropic/claude-sonnet-4.5",
"modeChat": false,
"modeClient": true,
"systemPrompt": "You help clients of the broker in the trading terminal.",
"toolNames": ["get_account_balance", "get_open_trades"],
"dailyCostLimit": 5
}
{
"command": "MngAddAIAgent",
"extID": "1",
"data": { "name": "Client assistant", "model": "anthropic/claude-sonnet-4.5", "modeClient": true }
}
const agent = await platform.MngAddAIAgent({ name: 'Client assistant', model, modeClient: true });
Parameters¶
| Parameter | Type | Description |
|---|---|---|
name |
string | Required, up to 128 characters, unique inside the brand |
model |
string | Required. Model id from MngGetAIModels |
description |
string | Up to 512 characters |
enabled |
bool | Default true |
modeChat |
bool | May answer employees |
modeClient |
bool | May answer clients in the terminal. Default false |
modeWorkflow |
bool | May generate notifications from events |
fallbackModels |
array | Models to try if the primary one fails |
systemPrompt |
string | Up to 20 000 characters |
temperature |
float | 0 to 2 |
maxTokens |
int | 0 means the model's own limit |
toolNames |
array | White list of tools. Empty means no tools at all |
knowledgeScopes |
array | Knowledge sections the agent may use |
dailyRequestLimit, dailyTokenLimit, dailyCostLimit |
number | Daily caps; 0 disables a cap |
global |
bool | Super administrator only: the agent becomes visible to every brand |
The three modes are independent on purpose. An agent written for the backoffice has an internal prompt and access to other people's accounts, so it must not become a client assistant by accident.
Response Data¶
The created agent, in the shape returned by MngGetAIAgentsByFilter.
Errors¶
| Code | Error | Description |
|---|---|---|
400 |
AI_INVALID_DATA |
An agent with this name already exists in the brand, or a field is out of range |
403 |
AI_ACCESS_DENIED |
Not an administrator, or global requested without super administrator rights |