Agents
The agent inventory lists every governed agent: who owns it, its state, whether it has a spend ceiling, and when it was last seen.
The lifecycle
An agent is in one of four states:
| State | Meaning |
|---|---|
| registered | Has never made a governed call. Its credential can be issued or sealed pending a browser claim. Check credential state and the deployed service if expected traffic is missing. |
| active | Has made at least one governed call. The first call sets this automatically. |
| paused | Its calls are refused. Someone paused it, or guardrail auto-pause did when findings crossed the threshold. |
| retired | Out of service, with credentials revoked and history kept. An admin can restore it directly; its owner can request approval. It then needs a new credential and resume. See Retire and restore. |
Retire and restore
Retire an agent from Lifecycle on its record. A retired agent stays in the inventory with its history, and its keys are revoked for good.
To bring it back, select the retired agent in the inventory and choose Restore, or choose Restore agent under Lifecycle on its record. Admins, owners and the agent's own owner see the action.
- Admin or owner: Restore applies at once. A reason is optional and is kept in the audit record.
- The agent's owner: Request restore sends an
agent.restoreapproval to the admins and owners you pick. A reason is required. The agent comes back once one of them approves.
The agent returns paused. Its old keys never work again. To give it a working key, choose Rotate credential, then resume the agent.
Register an agent
Registration requires builder access or agents:write. The plan's resource
cap also applies; Free allows two agents. Pause, retirement, restore, and purge
require the agent lifecycle entitlement, available on Pro and Enterprise.
Click Register on the inventory
Opens the registration dialog.
Name the agent
For example
invoice-classifier. The name appears on every inventory row and audit entry.Assign an owner (required)
The person accountable for the agent. Only admins, and roles with the
agents:assign_ownerpermission, can name someone else; anyone else registers the agent under their own name. The same rule applies when you reassign an agent later.Choose the model (required)
The model the agent runs on. The console also sets the credential's
allowed_modelsto that model. On chat calls with the agent credential, the configured model overrides the request's model. Change the configured model from the agent's page; model changes follow the applicable approval and ownership policy.Describe what it does
Optional. The tool-suggestion pass uses it, and colleagues read it when deciding whether the agent can be turned off.
Add feature tags
Optional, comma-separated (for example
checkout, invoicing, pii-sensitive). Spend, refusals and findings roll up by feature as well as by agent.Choose when its key expires
Optional. Key expiration starts at No expiration. Choose a length (7 days to 1 year) and the agent's key stops working that long after it is issued. Each rotation gives it the same length again. Once it expires, the agent's calls get
401 {"detail":"api key expired"}until someone rotates the key.Click Create agent
Forgebench creates the agent and its credential. The credential is shown once; copy it before closing the dialog. The agent starts as registered, with no tool access.

The same screen shows a ready-to-copy call in curl, Python or the OpenAI SDK shape, with the key filled in and the X-Agent-Version header to send. An indicator changes when the agent's first call arrives.
Set its spend ceiling
Registration applies the workspace's agent budget policy. Without a saved
policy, the monthly defaults are $5 on Free, $25 on Pro, and $100 on Enterprise,
clamped to the workspace cap. Key daily, request-rate, model, and MCP-call
limits are also applied. Check the returned applied_caps and edit the
per-agent monthly cap in Budgets.
Go to Budgets → Per-agent caps
Each agent is listed with its monthly cap, spend so far and remaining balance.
Click Edit on the agent's row
Opens
Edit monthly cap: <agent name>.Set the monthly limit (USD)
Set a cap within the workspace budget. Builders can lower a cap and raise it only to their self-service ceiling. Removing a cap requires an admin.
Save
The cap applies immediately, alongside the workspace budget.
Call from your code
The credential from registration is the agent's API key. Store it where your service reads secrets. Calls with it are attributed to the agent in traces, audit and budgets.
The examples read the key from FORGEBENCH_API_KEY. A repository onboarded with several agents gives each agent its own variable, FORGEBENCH_KEY_<AGENT_NAME> in upper snake case, so each agent builds its own client from its own key. For agents registered through onboarding the name is pinned and never renamed; for agents registered elsewhere it is computed from the agent count (the manifest marks them unpinned) and can change when the count changes. Reveal each key once: a second claim rotates it. See Budgets & Agent Keys.
import os
from forgebench import Forgebench, ForgebenchError
client = Forgebench(api_key=os.environ["FORGEBENCH_API_KEY"],
base_url="https://api.forgebench.ai")
try:
resp = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "..."}],
)
except ForgebenchError as e:
log.error("call failed: %s", e)import { Forgebench, ForgebenchError } from "@seedlinglabs/forgebench-sdk";
const forgebench = new Forgebench({
baseUrl: "https://api.forgebench.ai",
apiKey: process.env.FORGEBENCH_API_KEY!,
});
try {
const res = await forgebench.chat.create({
model: "gpt-4o",
messages: [{ role: "user", content: "..." }],
});
} catch (e) {
if (e instanceof ForgebenchError) {
console.error("call failed", e);
} else {
throw e;
}
}import ai.forgebench.ChatCompletionRequest;
import ai.forgebench.ChatMessage;
import ai.forgebench.Forgebench;
import ai.forgebench.errors.ForgebenchException;
import ai.forgebench.types.ChatCompletion;
Forgebench client = Forgebench.builder()
.apiKey(System.getenv("FORGEBENCH_API_KEY"))
.baseUrl("https://api.forgebench.ai")
.build();
try {
ChatCompletion resp = client.chat().completions().create(ChatCompletionRequest.builder()
.model("gpt-4o")
.addMessage(ChatMessage.user("..."))
.build());
} catch (ForgebenchException e) {
log.error("call failed: {}", e.toString());
}export FORGEBENCH_API_KEY=sk_... # the agent's own credential
curl -X POST https://api.forgebench.ai/v1/chat/completions \
-H "Authorization: Bearer $FORGEBENCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "..."}]
}'The agent's configured model is authoritative for its credential's chat calls.
Model allowlists and routing restrictions are additional checks. Registration
through the API inherits the workspace's model policy when allowed_models
is omitted; an explicit null requests an unrestricted credential, subject to
the remaining policy checks. The console pins it to the chosen model.
Tool bindings and guardrail scanning need no code changes. You configure them for the agent in Tool Registry, MCP and Guardrail findings.
Handle agent-specific errors
Besides the general codes in Errors and refusals, two errors are specific to agents:
| Status | Cause | Body |
|---|---|---|
401 | A paused agent is refused at authentication. Retirement revokes its
keys, so an old retired-agent key normally reports api key revoked. | {"detail": "agent is paused"} |
403 | model_not_allowed: the call named a model not in the
credential's allowed_models. | {"detail":{"error":"model_not_allowed","model":...,"allowed_models":[...]}} |
A paused agent, revoked credential, and unknown key all return 401. Check
the body for agent is paused, api key revoked, or unknown api key before
deciding whether to resume the agent or replace a credential.
For model_not_allowed, e.code is None: the identifier is in
detail.error, not detail.code (unlike tool_not_authorized and
mcp_tool_not_authorized). Branch on e.body["detail"]["error"]:
import os
from forgebench import Forgebench, AuthenticationError, PermissionDeniedError
client = Forgebench(api_key=os.environ["FORGEBENCH_API_KEY"],
base_url="https://api.forgebench.ai")
try:
resp = client.chat.completions.create(model="gpt-4o", messages=[{"role": "user", "content": "..."}])
except AuthenticationError as e:
log.error("agent auth failed: %s", e)
except PermissionDeniedError as e:
detail = (e.body or {}).get("detail", {})
if detail.get("error") == "model_not_allowed":
log.error("model %s not allowed; allowed: %s", detail["model"], detail["allowed_models"])
else:
log.error("not authorized: %s", e.body)import { Forgebench, AuthenticationError, PermissionDeniedError } from "@seedlinglabs/forgebench-sdk";
const forgebench = new Forgebench({
baseUrl: "https://api.forgebench.ai",
apiKey: process.env.FORGEBENCH_API_KEY!,
});
try {
const res = await forgebench.chat.create({ model: "gpt-4o", messages: [{ role: "user", content: "..." }] });
} catch (e) {
if (e instanceof AuthenticationError) {
console.error("agent auth failed", e.body);
} else if (e instanceof PermissionDeniedError) {
const detail = (e.body as { detail?: Record<string, unknown> })?.detail ?? {};
if (detail.error === "model_not_allowed") {
console.error(`model ${detail.model} not allowed; allowed: ${detail.allowed_models}`);
} else {
console.error("not authorized", e.body);
}
} else {
throw e;
}
}import ai.forgebench.ChatCompletionRequest;
import ai.forgebench.ChatMessage;
import ai.forgebench.Forgebench;
import ai.forgebench.errors.AuthenticationException;
import ai.forgebench.errors.PermissionDeniedException;
import ai.forgebench.types.ChatCompletion;
import java.util.Map;
Forgebench client = Forgebench.builder()
.apiKey(System.getenv("FORGEBENCH_API_KEY"))
.baseUrl("https://api.forgebench.ai")
.build();
try {
ChatCompletion resp = client.chat().completions().create(ChatCompletionRequest.builder()
.model("gpt-4o").addMessage(ChatMessage.user("...")).build());
} catch (AuthenticationException e) {
log.error("agent auth failed: {}", e.toString());
} catch (PermissionDeniedException e) {
Map<?, ?> body = e.getBody() instanceof Map ? (Map<?, ?>) e.getBody() : Map.of();
Map<?, ?> detail = body.get("detail") instanceof Map ? (Map<?, ?>) body.get("detail") : Map.of();
if ("model_not_allowed".equals(detail.get("error"))) {
log.error("model {} not allowed; allowed: {}", detail.get("model"), detail.get("allowed_models"));
} else {
log.error("not authorized: {}", e.getBody());
}
}# -i prints the status line: 401 for a paused agent or a bad key, 403 for model_not_allowed
curl -i -X POST https://api.forgebench.ai/v1/chat/completions \
-H "Authorization: Bearer $FORGEBENCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "..."}]
}'Inventory columns
- Owner: who to ask.
- Tags: filter the inventory by feature.
- State: one of the four agent states.
- Version: the latest
X-Agent-Versionreported by the calling service. - Budget: whether a ceiling is set. Blank means no per-agent cap.
- Error rate: tool-call failures. A rising rate usually means a tool changed.
- Last seen: the agent's most recent call.
Agent detail
Open a row to see one agent's credential, policy, version history and recent tool activity. Start here when an agent behaves unexpectedly.
| Tab | What it shows |
|---|---|
| Overview | What the agent may do: its MCP and Registry tool access and its model, plus its most recent calls and bound tools. |
| Tools | Two allowlists: MCP allowlist (see MCP) and Registry (see Tool Registry). With nothing bound in either, the agent can call no tools. |
| Credentials | Rotate the credential if it is lost or compromised; the agent keeps its identity and history. Rotation replaces the stored secret with no planned overlap, so prepare the service to use the replacement. Already admitted calls are not cancelled. Revealing a credential through a claim link for an agent with a live key also rotates it. |
| Versions | Built from the X-Agent-Version header on each call. Empty until the agent sends that header. |
| Calls, Tool activity, Guardrails | Traces, tool-call history and guardrail findings for this agent only. |
Any string works as a version, and a new value shows up as soon as the client sends it. Set the header once when you construct the client:
from forgebench import Forgebench
client = Forgebench(
api_key="sk_...",
base_url="https://api.forgebench.ai",
default_headers={"X-Agent-Version": "1.4.0"},
)
resp = client.chat.completions.create(
model="mock-gpt",
messages=[{"role": "user", "content": "hello from invoice-classifier"}],
)import { Forgebench } from "@seedlinglabs/forgebench-sdk";
const forgebench = new Forgebench({
baseUrl: "https://api.forgebench.ai",
apiKey: process.env.FORGEBENCH_API_KEY!,
defaultHeaders: { "X-Agent-Version": "1.4.0" },
});
const res = await forgebench.chat.create({
model: "mock-gpt",
messages: [{ role: "user", content: "hello from invoice-classifier" }],
});import ai.forgebench.ChatCompletionRequest;
import ai.forgebench.ChatMessage;
import ai.forgebench.Forgebench;
import ai.forgebench.types.ChatCompletion;
Forgebench client = Forgebench.builder()
.apiKey("sk_...")
.baseUrl("https://api.forgebench.ai")
.defaultHeader("X-Agent-Version", "1.4.0")
.build();
ChatCompletion resp = client.chat().completions().create(ChatCompletionRequest.builder()
.model("mock-gpt")
.addMessage(ChatMessage.user("hello from invoice-classifier"))
.build());curl -X POST https://api.forgebench.ai/v1/chat/completions \
-H "Authorization: Bearer sk_..." \
-H "X-Agent-Version: 1.4.0" \
-H "Content-Type: application/json" \
-d '{
"model": "mock-gpt",
"messages": [{"role": "user", "content": "hello from invoice-classifier"}]
}'The TypeScript chat methods accept per-call headers in their second argument.
For Python and Java chat calls, use a separate client with different default
headers to report a different version from the same process.
The right-hand rail shows State, Ownership, Limits (model and per-agent monthly cap), Activity this cycle, Bindings, Feature tags and Lifecycle, where you retire the agent.

