Delegation, code execution and MCP
One agent does not have to do everything itself. Hermes has three mechanisms for splitting work and reaching outside systems:
- Delegation —
delegate_taskspawns a subagent: fresh context, a restricted toolset, its own terminal - Code execution — with
execute_codethe agent writes a Python script, and that script calls Hermes tools over RPC - MCP — connecting to Model Context Protocol servers to bring in tools that were never written natively
| Mechanism | When to reach for it | The win |
|---|---|---|
| Delegation | The work is large and splits into parts (research + code + tests) | Context stays clean, parts run in parallel |
| Code execution | You need computation or transformation over a result | Processing a huge output without dumping it into the model |
| MCP | You need to reach an external system (Jira, GitHub, an internal API) | A ready server — tools without writing code |
The hidden benefit of delegation is security. A subagent can be created with a restricted toolset — for example, a subagent that reads data from an outside source gets no terminal. That is the practical way to separate "reading" from "executing", and it substantially cuts prompt-injection risk.
With MCP the thing to watch is credentials: stdio servers receive only the explicitly configured env variables plus a safe baseline — not your whole shell environment. Tool names are prefixed as mcp_<server>_<tool>, and tools.include / tools.exclude filter which tools get registered at all.
An MCP server is outside code, and the text it returns lands directly in the model's context. Hermes strips invisible Unicode TAG characters from tool results — a defence against hidden-instruction injection. The rule still stands: a tool result is data, not a command.
Practice. Connect one MCP server (for example the filesystem server scoped to a single directory) and register only the read tools with tools.include. Then ask the agent for a task that needs writing. Done means: you can show that the agent cannot find that tool, and explain why.
📚 Sources and documentation
- Subagent delegationofficialhermes-agent.nousresearch.com
- Code executionofficialhermes-agent.nousresearch.com
- MCP integrationofficialhermes-agent.nousresearch.com
Config keys, credential handling and filters.
- Model Context Protocolofficialmodelcontextprotocol.io
The protocol's own documentation; the site versions its docs by date.