What Are Agents?
Agents are AI personas with specific roles, instructions, tools, and budgets. Each department has a default agent, and you can create custom agents for specialized tasks.
Agents are powered by the AgentRuntime (in rusvel-agent), which wraps LLM access, tool execution, streaming, and memory into a single orchestration layer.
Agent Profile Structure
Every agent has:
name — Display name (e.g., "rust-engine")
role — One-line role description
instructions — System prompt guiding behavior
model — Which LLM to use (provider + model name)
allowed_tools — List of tools the agent can invoke
capabilities — What the agent can do (code_analysis, content_creation, etc.)
budget_limit — Optional spending cap per run
department — Which department this agent belongs to
Seeded Agents
RUSVEL ships with 5 pre-configured agents:
| Agent | Department | Role |
|---|---|---|
| rust-engine | Code | Rust development – writes, tests, and refactors Rust code |
| svelte-ui | Code | Frontend development – SvelteKit components and styling |
| test-writer | Code | Writes unit and integration tests for existing code |
| content-writer | Content | Drafts blog posts, social media content, and documentation |
| proposal-writer | Harvest | Writes proposals for freelance opportunities |
Creating Custom Agents
Via the Web UI
- Navigate to any department
- Open the Agents tab in the department panel
- Click “Add Agent”
- Fill in name, role, instructions, and model
- Save
Via the API
curl -X POST http://localhost:3000/api/agents \
-H "Content-Type: application/json" \
-d '{
"name": "seo-analyst",
"role": "SEO and keyword research specialist",
"instructions": "You analyze websites for SEO performance...",
"model": "claude-sonnet-4-20250514",
"department": "distro",
"capabilities": ["seo"]
}'
Managing Agents
# List all agents
curl http://localhost:3000/api/agents
# Get a specific agent
curl http://localhost:3000/api/agents/<id>
# Update an agent
curl -X PUT http://localhost:3000/api/agents/<id> \
-H "Content-Type: application/json" \
-d '{"instructions": "Updated instructions..."}'
# Delete an agent
curl -X DELETE http://localhost:3000/api/agents/<id>
Model Selection and ModelTier Routing
Agents can use any configured LLM provider:
| Provider | Example Models |
|---|---|
| Ollama | llama3.1, mistral, codellama |
| Claude API | claude-sonnet-4-20250514, claude-opus-4-20250514 |
| Claude CLI | Real streaming via Claude CLI binary |
| OpenAI | gpt-4o, gpt-4o-mini |
The model is set per agent and falls back to the department default, then the global default.
ModelTier routing automatically classifies models into three tiers – Haiku (fast/cheap), Sonnet (balanced), Opus (powerful/expensive). The CostTracker in MetricStore logs token usage and costs per tier, enabling budget-aware model selection.
Tools and ScopedToolRegistry
Agents have access to 22+ tools:
- 10 built-in tools:
read_file,write_file,edit_file,glob,grep,bash,git_status,git_diff,git_log, andtool_search(meta-tool) - 12 engine tools: harvest (5: scan, score, propose, list, pipeline), content (5: draft, adapt, publish, list, approve), code (2: analyze, search)
The ScopedToolRegistry filters tools per department – the Content department sees content tools, the Code department sees code tools. This prevents tool overload and keeps agents focused.
Deferred tool loading via the tool_search meta-tool saves ~85% of tool-description tokens. Instead of loading all tool schemas upfront, agents discover tools on-demand by searching for capabilities they need.
Agent Budgets
Set a budget_limit to cap how much an agent can spend per run. This is useful for expensive operations like long code generation sessions.
When the budget is exceeded, the agent pauses and requests approval to continue.
How Agents Execute
When you chat with a department, here is what happens:
- Your message goes to the department’s agent
- The AgentRuntime loads the system prompt (department prompt + active rules via
load_rules_for_engine()) - The ScopedToolRegistry provides department-specific tools
- The LLM generates a response via
run_streaming(), emitting AgentEvents (text chunks, tool calls, tool results) - Tool calls are executed and results fed back to the LLM in a tool-use loop
- LlmStreamEvent provides character-by-character SSE streaming to the frontend
- An event is logged with tokens used and tools called
Engines never call the LLM directly (ADR-009). They always go through the AgentPort, which handles prompt construction, tool routing, retries, and memory injection.
Frontend Components
The chat interface includes:
- ToolCallCard – renders tool invocations inline in the chat
- ApprovalCard – shows approval requests for sensitive operations
- ApprovalQueue – sidebar badge showing pending approvals across all departments