Agent.yml
The default way to define an agent - plain settings in a YAML file, no code.
On this page
Agent.yml
Agent.yml is the default way to define an agent. It is a plain YAML file - a name, a model, and any of the optional settings below - and the build turns it into a running agent. Most agents need nothing more than this file and an instructions.md beside it.
name: support
description: Answers customer questions about orders
model: openai/gpt-5
environments:
test:
model: mock/mock-model
bxAgents new scaffolds exactly this shape. When the definition needs real code (hooks, dynamic instructions, tools registered in code), use the advanced option instead: a class-based Agent.bx, scaffolded with bxAgents new --class.
A folder holds one agent definition. An Agent.yml together with an Agent.bx in the same folder is an error - two definitions of one agent would leave it ambiguous which settings win - and build fails and names both files so you can keep one. This applies to the project root and to every subagent folder, and a project can mix the two: a YAML root with a class-based subagent, or the other way round.
Settings
| Key | Type | Notes |
|---|---|---|
name | string | Also becomes this agent's config/WireBox.bx binding key at build time, so it must be unique across the whole project (root + every subagent). |
model | string | A provider/model slug, a bare provider name, or a model name when provider is set. See The model slug and Models and profiles. |
provider | string | The default provider, a bx-ai provider name. With model as a bare model name. See Models and profiles. |
params | mapping | Default request parameters, such as temperature. |
options | mapping | Default provider options, such as timeout. |
providers | mapping | Per provider params and options, by provider name. |
profiles | mapping | Named combinations. Each profile takes description, provider, model, params, options, apiKeyEnv (the name of the variable that holds the key, never the key) and optionally contextWindow and vision. See Models and profiles. |
contextWindow, vision | number, boolean | What the default model can hold (tokens) and whether it can see images. Optional facts for the chat; bx-ai does not read them. See Models. |
defaultProfile | string | The profile used when nothing asks for another. |
profile | string | The profile this agent uses. |
embeddings, speech, transcription, image | mapping | bx-ai's capability defaults: provider, model and a few settings each. |
description | string | Optional. |
instructions | string | Optional inline instructions. See Instructions. |
tools | list of strings | Module tools this agent gets, as item@module or *@module. See Tools. |
toolOptions | mapping | Options for a module's tools, keyed by module name. See Tool options. |
subAgents | list of strings | Names of sibling folders under the root project's subagents/. See subagents/. |
mcpServers | list | MCP servers - each entry a URL string, a mapping with url and the credentials the server wants (token, headers, timeout), or a mapping with command for a server that runs as a program (env, cwd, prefix, toolFilter). See mcp/. A web server can take oauth so each person signs in to it: see connect. |
connectors | mapping or none | Which of the built-in connectors the agent offers: only, exclude, override, toolWarning. Left out, all seven are offered and none is connected until a person connects it. |
security | mapping | Forwarded verbatim into the generated app's bxai module settings; bx-ai's own SecurityDirector turns it into guardrail middleware. |
memory | string or mapping | The agent's conversation memory. Left out, every agent (the root and each subagent) remembers in the chat database, one row per person and conversation under its own name, so the same person finds the same conversation from the terminal, the web page and the API. maxMessages (20 to 100000, default 500) is the most it keeps of one conversation, dropping the oldest, and keepRecent (default 20, lower than maxMessages) is how many of the latest messages stay as they are when /compact summarizes the rest. A bare string is a memory type (cache); a mapping with a type is { type, ...config } passed through to aiMemory() exactly as written, and replaces the default. A memory is keyed by the agent's name, so one that is kept on disk is found again on the next start; set key in the mapping to name it yourself. |
checkpointer | mapping | { type: cache\|file\|jdbc, ...config }. Defaults to { type: cache } if omitted. |
gatewaySession | mapping | { policy, maxQueueDepth, attachments, commands }, all optional. policy is queue (default), reject, steer or interrupt. attachments: false switches off pictures and files sent in gateways. commands is { enabled, prefix, prefixes, conversation, allow, admins }. See Gateways. |
agentApi | mapping | { enabled, access, tokenEnvVar, tokens, profiles, path, allowedIPs, rateLimit, manageTokens, embeds }, all optional. enabled defaults to true, access to open (or token when tokenEnvVar or tokens is set), tokens and manageTokens to false, path to /__bxagents. See agentApi for each key. |
notes | mapping | Short notes the agent keeps about the user and its own work. notes: {} turns them on with the defaults. See Notes. |
vault | mapping | Gives the agent vault_list and vault_request and scrubs vault secrets from tool results. vault: {} turns it on. See the vault. |
routines | mapping | Prompts the agent runs on a schedule, made by asking it. Off unless enabled: true. maxPerUser, minInterval, maxParallel, maxPromptLength, approvalTimeout, timezone, summaryLength, maxReportSize and maxReportFiles set the limits. See routines. |
skills | mapping | Skills the agent saves for itself. agentCanSave (default true) gives the root agent a skill_save tool; autoApprove (default false) skips the person's approval of each save; builtin (default true) keeps the six skills that bxAgents ships available to the agent, and false leaves them out. Saved skills live in the data home and are in the agent's skill list at once. See data and volumes. |
data | mapping | Where the agent keeps everything: data: { home: ~/.nanobox }. See data and volumes. data.home can not be set in a person's file, because it decides where the agent's own file lives. |
volumes | mapping | Host folders the agent's file tools may use, by name: volumes: { notes: { path: ~/Notes, mode: rw } }. See data and volumes. A person can add volumes in their own files: see layered settings. |
usage | boolean | Records what each model call used (the time, who, the provider, the model and the tokens), for bxAgents stats and /stats. Off by default: set usage: true to turn it on. Counts only, never what was said. A person can turn it on in their own files, and it applies when the app starts. |
tui | mapping | How the terminal chat looks and behaves: { prompt, widgets: { top, bottom }, fullscreen, header, spacing, theme, animations, thinking, tools, markdown, menuRows, notify, terminalTitle }, all optional. The settings after widgets are listed in Settings; this block is the project's suggestion, and a person's own files win over it. prompt is bars (default), bars-hints, rule, box or panel; widgets list what goes in the top bar and at the bottom (agent, profile, folder, user, clock, machine, git, date, session, elapsed, ctx). A wrong name is refused and the valid ones are listed. See The prompt and the tables. |
extensions | mapping | Values for the project's extensions, by extension name, and what to turn off: { disable: [ roll, "deploy:deploy" ], deploy: { target: production } }. Each extension's block is merged over the defaults its configure() sets. A person's own files can set values too, and theirs win. |
environments | mapping | Per-environment overrides. See Environments. |
These are the same settings an Agent.bx's configure() returns, so every behavior documented for them applies unchanged.
An unknown key is an error, and the message lists the valid ones. A typo such as modle: would otherwise do nothing, quietly. Anything free-form belongs in an Agent.bx.
A value of the wrong type (a text where a list belongs, say) and an empty value (model: with nothing after it) are errors too.
Every setting except name and data.home can be overridden or added to from ~/.bxagents/Agent.yml (every agent) and ~/.bxagents/<agent>/Agent.yml (one agent), when the agent is built and again when a built app starts. See layered settings.
Tools
An agent gets its own tools/ folder, and nothing else, unless it asks. The tools other modules provide (bx-ai's built-ins, bx-playwright, ...) are a catalog: they are available, but an agent only has the ones its tools: list names. Every entry is item@module, the key bx-ai keeps them under:
name: support
model: openai/gpt-5
tools:
- now@bxai # one tool from one module
- "*@bxplaywright" # every tool that module registered (quote it: * starts a YAML alias)
| Entry | Gives the agent |
|---|---|
item@module | that one tool |
*@module, or @module | every tool the module registered |
- Default. No
tools:means only the agent's owntools/. This holds for every subagent too: each one has its owntools/and its owntools:. - Naming a module validates it. If the module is not installed, or has no such tool,
buildand the generated app fail with a message that lists what the module does provide. - A bare name is an error.
nowfails with a hint to writenow@bxai. bx-ai would otherwise resolve it to whichever module registered a tool callednowfirst. - Own tools win. If a tool in the agent's
tools/has the same name as a module tool it selected, the own tool is used and the module tool is left out, with a warning in thebxagents-toolslog. - Each tool once. Listing a tool twice, or listing it along with a
*@modulethat covers it, attaches it once.
Tool options
toolOptions configures the tools of a module, keyed by module name. Two modules take options: bxai, for its file tools, and bxplaywright, whose options are those of bx-playwright's playwright(): a profile (a name, or a list of names) and settings such as headless, baseURL, browser, viewport or device.
tools:
- "*@bxplaywright"
toolOptions:
bxplaywright:
profile: mobile
headless: false
baseURL: ${env.APP_URL:http://localhost:8080}
- Each agent gets its own browser. The browser tools bx-playwright registers share one browser for the whole app. An agent that lists
bxplaywrighttools does not get those: it gets a fresh set built for it alone (playwright( profile, options ).aiTools()), so a root agent and its subagent never drive the same page. The browser opens when one of its tools is first used, not at startup.*@bxplaywrightworks with notoolOptionsat all and uses the module's own settings. - Environment values.
${env.NAME}` and `${env.NAME:default}are replaced with the environment variable when the app starts, never at build time, so a secret or a per-machine setting stays out of the project. A variable that is not set and has no default fails the agent at startup, naming it. - Checked at build time. A key that is not a module the agent lists tools from, a module that takes no options, a key written as
item@module, or an option bx-playwright does not have (the message lists the valid ones) is abuilderror. - The module-wide settings (where browsers are installed, the default profile) stay in bx-playwright's own settings, not here.
File tools
bx-ai has 19 file tools (readFile, writeFile, listDirectory, searchFiles, deleteFile, zipFiles and more), but it registers none of them. In BxAgents an agent gets them by listing them and naming the folders they may use in toolOptions.bxai.allowedPaths:
tools:
- readFile@bxai
- listDirectory@bxai
toolOptions:
bxai:
allowedPaths:
- tmp # the system temp folder
- cwd # the folder the agent is started from
- /data/reports # or an absolute path
- Each agent gets its own tools, locked to its own folders. A path outside them is refused (
..tricks included), and the tools are never put in the shared registry where another agent could pick them up. - No folders, no tools. The tools exist only when
allowedPathsis set, and an empty list is a build error, because bx-ai reads an empty list as "any path". ListingreadFile@bxaiwith noallowedPathsfails with a message saying so. now@bxai,httpGet@bxai,webSearch@bxaiand the rest of bx-ai's registered tools keep working as before, with or withouttoolOptions.bxai.*@bxaiincludes the file tools onceallowedPathsis set.- An entry may be
${env.NAME}to take a folder from the environment. bxAgents newcan write all of this for you: see the new wizard.

Notes
An agent can keep short notes: things about the user ("prefers short answers") and things about its own work ("the repo uses Gradle"). They are off until the block is there:
notes: {}
notes:
provider: sqlite # built in. Or a class implementing INotesProvider
user: { limit: 1400 } # characters of user notes that go into the prompt
agent: { limit: 2200 } # characters of agent notes
tool: true # give the agent the note_remember and note_forget tools (default true)
approveForget: true # a person approves what the agent forgets (default true)
| Key | Default | Notes |
|---|---|---|
provider | sqlite | sqlite keeps one row per note in the shared chat database. Any other value is the name of a class that implements INotesProvider and is created with ( config, agentName ), for a notes service of your own. |
user.limit | 1400 | Characters of notes about the user, a whole number from 100 to 20000. Each user has their own. |
agent.limit | 2200 | Characters of notes about the agent's work, a whole number from 100 to 20000. Shared by everyone who talks to it. |
tool | true | remember (save or replace a note) and forget (remove one). Without them the notes are read-only for the agent and a person manages them. |
approveForget | true | A run that wants to forget stops for approval, like any tool that needs it. Saving a note needs none. |
How it works:
- Both scopes go into the system prompt as short lists, oldest first, within their limits. They are read once per conversation, so the prompt stays the same turn to turn (a provider's prompt cache keeps working) and a note saved now shows from the next conversation.
- A note is one line of at most 500 characters. Nothing is dropped silently: a note that does not fit the limit is refused, and the agent is told how full the notes are so it can replace or forget an older one.
- Who a user is: it is the name of the access token the caller used, or
localwhen the route is open.localis also who you are inbxAgents chat(--user=NAMEchanges it), so the terminal, the web page and the API share one set of conversations and notes on an open server. The agent scope belongs to the agent'sname. - The terminal chat, the web chat and the server share one file,
chat.dbin the data home (~/.bxagents/<agent name>/chat.dbby default; see the SQLite store).
Manage them yourself with /remember and /notes in chat, with bxAgents notes from a shell, or over HTTP through the run-control routes.
Instructions
The agent's instructions are its system prompt. Put them in an instructions.md beside Agent.yml, the usual choice because the file is plain Markdown and easy to edit:
my-agent/
βββ Agent.yml
βββ instructions.md
For a short prompt you can write them inline instead:
name: greeter
model: openai/gpt-5
instructions: |
You greet people by name.
Keep it to one sentence.
If both exist, instructions.md wins - the file is the more deliberate choice, so a stray instructions: line cannot override it. If neither exists, build fails and says so.
Environments
environments holds overrides keyed by environment name. It is the YAML spelling of the environment-override methods (production()) an Agent.bx can declare:
name: support
model: openai/gpt-5
environments:
production:
model: openai/gpt-5-mini
staging:
description: Staging copy
The active environment is chosen with this precedence, highest first:
- the
--environmentCLI flag (bxAgents build --environment=production) - the
BX_AGENTS_ENVenvironment variable development
Only the block for the active environment is applied, on top of the top-level settings; keys it does not mention are left alone. Each block accepts the same keys as the top level, except environments itself.
bxAgents test builds against the test environment, which is why a scaffolded project carries a test block pointing at the mock provider: its tests need no API key or network access.
An Agent.yml cannot compute its environment. The detectEnvironment() method described under Environment overrides needs code, so a project that needs it uses an Agent.bx.
The overrides then merge with boxlang.json, boxlang-{environment}.json, miniserver.json and miniserver-{environment}.json exactly as described in Merge semantics.
Requirements
Reading YAML needs the bx-yaml module, 1.1.0 or later. BxAgents bundles it, so there is nothing to install. Global YAML tags (such as !!java.io.File) are rejected, so a cloned project's Agent.yml cannot make the build instantiate arbitrary Java classes.
YAML or Agent.bx?
| Use | When |
|---|---|
Agent.yml | The agent is configuration: a name, a model, instructions, memory, subagents. This is almost every agent. |
Agent.bx | The definition itself needs code: hooks, dynamic instructions, tools registered in code, an overridden method, or detectEnvironment(). |
You can start with YAML and switch later: create the Agent.bx, move the settings across, and delete the Agent.yml.