Expand description
Agent system for MCP prompts and personas.
Agents are named personas that combine a system prompt, scoped tools, and optional dynamic context injection. They enable “assume a role” workflows in Cursor, Claude Desktop, and other MCP clients.
§Architecture
┌──────────────────────────────────────────┐
│ AgentRegistry │
│ ┌─────────┐ ┌─────────┐ ┌────────────┐ │
│ │ TOML │ │ Lua │ │ Custom │ │
│ │ Inline │ │ Script │ │ (Rust) │ │
│ └─────────┘ └─────────┘ └────────────┘ │
└──────────────┬───────────────────────────┘
▼
GET /agents/list · POST /agents/{name}/prompt§Agent Sources
| Source | Config Key | Struct |
|---|---|---|
| Inline TOML | [agents.inline.<name>] | TomlAgent |
| Lua script | [agents.script.<name>] | LuaAgentAdapter (in crate::agent_script) |
| Custom Rust | registry.register(...) | User-defined Agent impl |
§Usage
use context_harness::agents::{AgentRegistry, TomlAgent};
let mut agents = AgentRegistry::new();
agents.register(Box::new(TomlAgent::new(
"reviewer".to_string(),
"Reviews code against conventions".to_string(),
vec!["search".to_string(), "get".to_string()],
"You are a senior code reviewer.".to_string(),
)));See docs/AGENTS.md for the full specification.
Structs§
- Agent
Argument - An argument that an agent accepts.
- Agent
Info - Serializable agent info for the
/agents/listendpoint. - Agent
Prompt - A resolved agent prompt ready for the LLM.
- Agent
Registry - Registry for agents (TOML, Lua, and custom Rust).
- Prompt
Message - A message to inject into the conversation.
- Toml
Agent - An agent defined inline in TOML configuration.
Traits§
- Agent
- An agent persona that provides a system prompt and tool scoping.