Add an Agent
On this page
An agent is just an AgentConfig — name, systemPrompt, tools,
rules, and a model — dropped in a folder under agents/ as
agents/<name>/index.ts. Once it's there it's picked up automatically,
no registry to edit, no import to add. See Directory
Structure for the full folder layout. There are
two ways to create that folder.
Command line
npx loopengine add-agent weather-agent
# -> Created agents/weather-agent/index.ts
Generates agents/<name>/index.ts with a working AgentConfig stub, so
you don't have to memorize the folder shape by hand. Or skip the command
and write the folder yourself — nothing about how an agent gets
discovered cares which one you did.
Web interface
Open http://localhost:8787/agents (see Web UI) and use
its New agent button — fill in a name and, optionally under
Advanced, a system prompt and model provider, then submit. It's the same
POST /agents endpoint either way: a real agents/<name>/ folder lands
on disk, registered and live immediately, not a database row pretending
to be one.
Field defaults
Either way, most fields don't even need to be written out — they default to a conventional path under the agent's own folder:
| Field | Defaults to |
|---|---|
rules |
agents/<name>/actauth.yml (missing → deny everything) |
tools |
agents/<name>/tools/index.ts's exported tools (missing → no tools) |
skillsDirs |
agents/<name>/skills (missing → no skills) |
There's no subagents field to omit — agents/<name>/subagents/* is its
own folder convention (drop another agent's folder there and it becomes
one of this agent's tools automatically), always merged into tools on
top of whatever the table above resolves to.
The simplest possible agent, agents/weather-agent/index.ts — tools,
rules, and skillsDirs all omitted, so they default to
agents/weather-agent/tools/, actauth.yml, and skills/:
import type { AgentConfig } from 'loopengine'
export const config: AgentConfig = {
name: 'weather-agent',
systemPrompt: 'You answer questions about the weather.',
model: { provider: 'anthropic', model: 'claude-sonnet-5' }, // reads ANTHROPIC_API_KEY
}
See agents/customer-service/ and agents/file-agent/ for complete,
working examples. Once an agent exists, Configure an
Agent covers coming back to adjust its prompt,
tools, or permission rules.