Creating and Configuring Agents
Agents are the core abstraction in Nestor. Each agent has a role, an LLM adapter, a set of tools, and configurable guardrails.
Creating Agents
Use the CLI to create a new agent with an interactive wizard or flags:
# Interactive wizard
npx nestor-sh agent create
# With flags
npx nestor-sh agent create \
--name coder \
--adapter claude \
--model claude-sonnet-4-6 \
--description "A senior developer that writes clean TypeScript"
# List all agents
npx nestor-sh agent list
# Show agent config
npx nestor-sh agent config coder
Configuration
Agent configuration is stored in .nestor/agents/{name}.yaml. Here is a complete example:
# .nestor/agents/coder.yaml
name: coder
description: Senior TypeScript developer
adapter: claude
model: claude-sonnet-4-6
# System prompt / role instructions
instructions: |
You are a senior TypeScript developer.
Write clean, well-tested code.
Always explain your reasoning.
# Tool access
tools:
- file_read
- file_write
- shell_exec
- web_search
# Guardrails
guardrails:
max_iterations: 25
max_tokens_per_turn: 8192
require_approval:
- file_write
- shell_exec
blocked_commands:
- rm -rf
- sudo
# Cost budget
budget:
max_per_session: 5.00
max_per_day: 20.00
currency: USD
# Memory configuration
memory:
enabled: true
context_window: 200000
rag_enabled: true
LLM Adapters
Nestor supports 7 LLM providers through a unified adapter interface:
| Adapter | Provider | Models |
|---|---|---|
claude | Anthropic | claude-sonnet-4-6, claude-opus-4-6, haiku |
openai | OpenAI | gpt-4o, gpt-4o-mini, o1, o3 |
gemini | gemini-2.5-pro, gemini-2.5-flash | |
grok | xAI | grok-3, grok-3-mini |
mistral | Mistral | mistral-large, codestral |
ollama | Local | llama3.2, codellama, deepseek-coder |
openrouter | OpenRouter | 300+ models from all providers via unified API |
New in v3.4.0: The openrouter adapter gives access to 300+ models from all major providers through a single API key. Set adapter: openrouter and any model ID from the OpenRouter catalog.
All adapters implement the same LlmAdapter interface, so switching between providers is a one-line config change.
Model Router
The model router automatically selects the best model based on task complexity and budget:
# In agent config, use "auto" to enable routing
adapter: auto
model_preferences:
- claude-sonnet-4-6 # preferred
- gpt-4o # fallback
- ollama/llama3.2 # local fallback
Tools
Agents interact with the world through tools. Nestor provides built-in tools and supports custom tools via MCP (Model Context Protocol).
Built-in Tools
| Tool | Description |
|---|---|
file_read | Read files from the working directory |
file_write | Create or modify files |
shell_exec | Execute shell commands (sandboxed) |
web_search | Search the web for information |
web_fetch | Fetch content from URLs |
Requiring Approval
For sensitive tools, you can require user approval before execution:
guardrails:
require_approval:
- file_write # ask before writing files
- shell_exec # ask before running commands
Skills
Skills are reusable capabilities defined as SKILL.md files with system prompts, tool configurations, and instructions.
# Install a skill from the registry
npx nestor-sh skill install code-reviewer
# Install from git
npx nestor-sh skill install https://github.com/user/my-skill.git
# List installed skills
npx nestor-sh skill list
Memory
Agents maintain memory across sessions using a combination of:
- Conversation memory — Full context within a session
- Long-term memory — Key facts persisted to SQLite
- RAG memory — Semantic search over your codebase with embeddings
memory:
enabled: true
context_window: 200000 # max tokens in context
rag_enabled: true # enable codebase RAG
rag_paths: # directories to index
- src/
- docs/
Cost Budgets
Prevent runaway costs with per-session and per-day budgets:
budget:
max_per_session: 5.00 # hard stop at $5/session
max_per_day: 20.00 # daily limit across all sessions
warn_at: 0.80 # warn at 80% of budget
When the budget is reached, the agent gracefully stops and reports its progress.
Hat System
New in v3.4.0, the Hat System provides 5 specialized personas that configure tools, instructions, and behavior in one flag:
| Hat | Persona | Focus |
|---|---|---|
coder | Senior Developer | Code generation, review, testing, refactoring |
researcher | Research Analyst | Deep research, comparative analysis, citations |
security | Security Auditor | Vulnerability scanning, OWASP checks, hardening |
writer | Technical Writer | Documentation, blog posts, READMEs, guides |
osint | OSINT Investigator | People/company investigation, digital footprint |
# Use a hat in the shell
npx nestor-sh shell --hat security
# Use a hat for a mission
npx nestor-sh shell --hat osint
> Investigate the founders of Acme Corp
# Combine with agent selection
npx nestor-sh shell --agent coder --hat researcher
Each hat pre-configures the agent's system prompt, tool selection, and behavioral guidelines for its specialty. Hats can be combined with any agent and any LLM provider.
Trust Score
Every agent gets a trust score from A to F, computed from real execution history:
| Grade | Range | Meaning |
|---|---|---|
| A | 90-100 | Highly reliable, consistently accurate |
| B | 80-89 | Reliable with minor issues |
| C | 70-79 | Functional but needs improvement |
| D | 60-69 | Unreliable, frequent errors |
| F | 0-59 | Should not be used autonomously |
The score is based on:
- Accuracy — How often the agent produces correct results
- Safety — Whether guardrails were respected
- Cost Efficiency — Token usage relative to task complexity
- Reliability — Consistency across similar tasks
Tip: Use npx nestor-sh agent trust coder to view a detailed trust breakdown for any agent.
✎ Edit this page on GitHub · Last updated 2026-04-26