Docs

Quickstart: your first agent in under an hour

You’ll register one agent, connect one system (Anthropic here), and run the agent so every model call goes through the directory: it carries a badge naming the agent, the real key never leaves CodeBrix, and you can hold or stop it from the console.

You need: a CodeBrix space (https://<space>.codebrix.dev), its owner’s sign-in, the cbx CLI, and an Anthropic API key. Python 3.9+ or Node 18+.

1. Register the agent (console, 2 minutes)

Sign in, open Agents → Directory → Register agent:

2. Put the key in the vault (CLI, 1 minute)

shell
cbx vault put agents/support-bot/anthropic

The value comes from a hidden prompt, never an argument. Only the directory reads it, at call time; your agent never sees it.

3. Connect the system (console, 3 minutes)

Agents → Directory → Systems → Add system:

Tick hold on a rule to make a person approve each matching call first.

4. Give the agent its secret (console, 1 minute)

On the agent, Make a token (role app). It is shown once:

shell
export CBX_SPACE=<space>
export CBX_AGENT_TOKEN=cbxa_...    # the agent's only secret; it is traded for 15-minute badges

No secret at all is possible too: in CI, bind the workload’s OIDC identity to the agent (CBX_AGENT=support-bot, GitHub Actions is detected), or on a laptop use the device flow (Directory.device_login(agent="support-bot"): you approve a code in the console).

5. Run it

Install (until the package is on PyPI and npm, install it from the agents repository: pip install ./sdk/python, npm install ./sdk/node).

Python

agent.py
from codebrix import Directory
import anthropic

d = Directory()                                   # CBX_SPACE + CBX_AGENT_TOKEN
client = anthropic.Anthropic(base_url=d.system_url("anthropic"), api_key="cbx-badge",
                             default_headers=d.headers())   # or codebrix.langgraph / adapters below
print(client.messages.create(model="claude-sonnet-5-5", max_tokens=200,
      messages=[{"role": "user", "content": "Say hi"}]).content[0].text)

Node

agent.mjs
import { Directory } from 'codebrix'
import Anthropic from '@anthropic-ai/sdk'

const d = Directory.fromEnv()
const client = new Anthropic({ baseURL: d.systemUrl('anthropic'), apiKey: 'cbx-badge', fetch: d.fetch })
const msg = await client.messages.create({ model: 'claude-sonnet-5-5', max_tokens: 200, messages: [{ role: 'user', content: 'Say hi' }] })
console.log(msg.content[0].text)

d.headers() is a badge for the next 15 minutes; for long-running Python processes use an adapter, which refreshes it on every request. Node’s d.fetch always does.

Check the console: the call shows under the agent with its tokens and cost.

6. Hold, stop, and lend credentials

7. Frameworks

Claude Agent SDK

Python
from codebrix import claude_agent_sdk as cbx
ClaudeAgentOptions(env=cbx.env(d), mcp_servers=cbx.mcp_servers(d, profiles=["github"]),
                   hooks={"PreToolUse": [HookMatcher(hooks=[cbx.stop_hook(d)])]})
Node
import * as cbx from 'codebrix/claude-agent-sdk'
query({ prompt, options: { env: await cbx.env(d), mcpServers: await cbx.mcpServers(d, { profiles: ['github'] }), hooks: { PreToolUse: [{ hooks: [cbx.stopHook(d)] }] } } })

The Claude Agent SDK runs the Claude Code CLI as a child process, which can’t refresh a badge: ask for a longer one (Directory(ttl_seconds=3600)) and build the options per run.

OpenAI Agents SDK

Python
from codebrix import openai_agents as cbx
cbx.use(d)
Runner.run(agent, input, hooks=cbx.StopHooks(d))
Node
import * as cbx from 'codebrix/openai-agents'
await cbx.use(d)
cbx.stopHooks(d, runner)

LangGraph

Python
from codebrix import langgraph as cbx
model = cbx.chat_anthropic(d, model="claude-sonnet-5-5")
# add cbx.stop_guard(d) as a node
Node
import * as cbx from 'codebrix/langgraph'
await cbx.chatAnthropic(d, { model })
cbx.stopGuard(d)

When something’s refused

ErrorStatusWhat to do
Stopped / Paused423 / 403A person stopped or paused it; the message says who and why. Don’t retry another way.
StopUnreachable503CodeBrix Stop can’t be reached and the space holds such calls; retry shortly.
Held / HoldDenied / HoldExpired202Waiting for, refused by, or timed out on a person’s approval.
BudgetExceeded402The agent’s monthly budget is spent; raise it on the agent.
Refused403 / 429Not on the allowed list, blocked, or a cap; final.
BadgeRefused401Revoked, the agent killed, or a bad token.