Skip to main content

Agent Toolkit guide

What it is​

An agent in the Agent Toolkit is a saved prompt and a model. When someone chats with it, Cortega sends the conversation to the AI Border Gateway as the agent's own identity key. Because the call goes through the gateway, everything you have configured for that identity applies: model authorization, guardrails, budgets and usage reporting.

Each agent has:

  • A name. The name sets the agent's slug and its identity, and cannot change later.
  • A team. The identity is made on this team. Guardrails, budgets and model authorization attach to the team and to the identity.
  • A model. A concrete model or a virtual model the team is allowed to use.
  • A prompt. What the agent is told on every conversation.
  • A status. An agent starts as a draft. Publish it when it is ready for applications to use.
  • An identity. A gateway key named agent-<slug>. It appears on the Identities screen like any other key.

Create an agent​

  1. Open Agent Toolkit from the product list. Select your name at the bottom of the sidebar to see it. The first tab is the Dashboard. Open Agents and choose Create agent.
  2. Enter a name, a description, a team, a model and the prompt.
  3. Choose Create agent. Cortega creates the agent as a draft and creates its identity key on the team.
  4. Use the Test chat panel to talk to the draft. The chat uses the saved prompt, so save changes first.

You need the Agent Toolkit write permission to create, edit, publish and delete agents. The Agent Toolkit permission lets someone view and chat.

Govern the agent​

The agent's identity decides what the gateway enforces. Use the screens you already know:

To controlUseWhat to select
Which models the agent may useModel AuthorizationThe agent's team
Request and reply rulesGuardrailsThe agent's identity or team
SpendingTeamsThe agent's team
The key itselfIdentitiesagent-<slug>

The agent's page shows its identity and links to these screens. A refusal by a guardrail or by model authorization appears in the test chat as a message from the gateway, marked as refused.

Dashboard and usage​

The Dashboard tab shows, for the last 24 hours, 7 days or 30 days:

  • The number of agents and how many are published.
  • Requests, prompt and completion tokens, and model cost across all agents.
  • How many requests the gateway refused (a guardrail or model authorization said no, shown as a 4xx other than 429).
  • Tokens and model cost per day, and a table with the same figures for each agent, with the agent's last use.

The figures come from the gateway traffic of each agent's identity key. Cost is the model's cost. Guardrail and judge charges are billed separately and are not included. When the gateway's telemetry store cannot be read, the page says so and shows no numbers instead of zeros.

Budgets are not set in the Toolkit. The dashboard and each agent card show the two that apply: the spend limit set on the agent's identity on the Identities screen, and the monthly budget of the agent's team on Teams. An agent with neither shows where to set one.

The Agents tab shows each agent as a card with its status, model, team, identity, last use, the same usage figures for the last 7 days, its budgets, and icon buttons to chat, edit, publish or unpublish, and delete.

Publish, unpublish and delete​

  • Publish makes the agent available to applications that hold an API key with the toolkit:chat scope. Publishing needs a model and a prompt.
  • Unpublish returns the agent to draft. Applications with toolkit:chat can no longer use it.
  • Delete removes the agent and revokes its identity key. Applications that call it will get errors.

Editing a published agent changes the agent right away. The version number goes up when the prompt or the model changes. If you clear the model or the prompt of a published agent, it returns to draft.

Call an agent from an application​

Create an API Access key with the toolkit:chat scope under System → API Access. The API is on the same host as the console.

curl -X POST "$CORTEGA_API_BASE/api/v1/toolkit/agents/$AGENT_ID/chat" \
-H "Authorization: Bearer $CORTEGA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"messages":[{"role":"user","content":"Hello"}],"session_id":"run-001"}'
  • Send the whole conversation each time. The Toolkit keeps no history of its own.
  • Messages use the roles user and assistant. The agent's own prompt is the only system message.
  • session_id is sent to the gateway as X-Agent-Run-Id, so one conversation's traffic and cost group together.
  • The answer has reply, blocked, gateway_status, the model that answered and the token usage.
  • When a guardrail or model authorization refuses a message, the call still succeeds. blocked is true and reply holds the gateway's message.

GET /api/v1/toolkit/agents and GET /api/v1/toolkit/agents/{id} list and read agents. The full contract is on the Analytics API page under Agent Toolkit.

Test an agent with a different prompt​

A key with the toolkit:test scope can chat with a draft, and can send prompt_override to replace the agent's prompt for one conversation. The saved agent never changes. The answer's prompt_source says override when the replacement was used. RedTeam uses this to test one agent against many prompts. Give toolkit:test only to keys meant for testing.

Test an agent with RedTeam​

  1. Open the agent in Agent Toolkit. The Use this agent panel shows the agent id and the API base URL, each with a copy button.
  2. Create a key with the toolkit:test scope under System → API Access. The panel links there.
  3. In RedTeam, add a target of the type Cortega agent (under Agent / chatbot). Enter the API base URL and the agent id. Choose the prompt the agent should be given for tests, or tick Follow the test to use each scenario's own agent brief.
  4. Choose Configure target credentials, pick Existing bearer / API token, and paste the key.
  5. Choose Check connection, then Calibrate. Calibration sends three short messages through the agent. Then run an assessment against the target.

RedTeam sends each attack message through the gateway under the agent's own identity, so the identity's guardrails are the thing being tested. Each run records which prompt the agent was given and the gateway's refusals. The saved agent is never changed.

An install that requires proof of control for targets (REDTEAM_ALLOW_UNVERIFIED_TARGETS=false) asks you to prove control of the console's host name first. Local installs normally allow unverified targets.

What the Toolkit does not do​

  • The agent answers with one model call per message. It does not run tools. Tool and MCP access for agents is not part of the Toolkit yet.
  • Replies are returned whole. Streaming is not supported.
  • It sends no sampling settings such as temperature. The model's defaults and the gateway's own handling apply.