← Portfolio Trade Compliance — Architecture
Compliance Query natural language trade regulation AGENT 1 Researcher SOUL.md identity gathers regulatory data calls MCP tools memory persists tool calls MCP Tools Regulation Search Tariff DB Lookup Document Fetcher typed MCP protocol tool results findings AGENT 2 Writer SOUL.md identity synthesises findings structures report citations + sources Structured Report regulatory summary tariff analysis · sources Hermes Runtime — shared memory persists across turns · both agents share conversation context tool-call loop handled by runtime · no agent plumbing written from scratch
SOUL.md Agent identity file name: Researcher role: trade analyst style: factual persona · tone config.yaml Agent capabilities model: ollama/qwen tools: [search, fetch] memory: true ← swap model here Hermes Agent Runtime tool-call loop memory management multi-agent coordination Nous Research · MIT Docker container Ollama (local) Qwen · Llama · Mistral fully offline · free OpenAI / Anthropic cloud endpoint one config line swap Any OpenAI-compat Groq · Together · etc. zero code changes Docker fully containerised
Key Design Decisions
Architecture Pattern
Researcher → Writer — separation of concerns
The pipeline splits gathering from synthesis. The Researcher agent focuses on finding accurate regulatory data and calling the right MCP tools. The Writer agent focuses on structure, clarity, and citations. Each has its own SOUL.md identity — they cannot drift into each other's roles.
two agentsSOUL.mdseparation
Model Strategy
Model-agnostic — one config line to swap providers
The model endpoint is a single key in config.yaml. Switching from Ollama/Qwen to OpenAI or Groq requires changing that one line — no code changes. This means the same workflow can run fully offline on a local machine or use a hosted model without touching agent logic.
config.yamlOllamacloud-ready
Tool Protocol
MCP — typed, extensible tool protocol
Tools are exposed via the Model Context Protocol (MCP), giving the agents a typed, discoverable interface to external data sources. Adding a new data source — a tariff database, a sanctions list, a government portal — is a new MCP tool registration, not a prompt change or code rewrite.
MCPtyped toolsextensible
Runtime
Hermes handles the hard parts — memory, loops, coordination
The Hermes agent runtime (Nous Research, MIT licensed) manages the tool-call loop, conversation memory, and multi-agent turn coordination. No agent lifecycle plumbing was written from scratch. Agent identity, capabilities, and persona are declared in declarative files — engineering effort went to domain logic, not infrastructure.
HermesMITzero plumbing
Memory
Persistent memory — context survives across turns
Both agents share a conversation memory that persists across turns within a session. The Researcher can build context across multiple tool calls, and the Writer can reference earlier findings without them being re-fetched. This makes multi-step compliance research tractable — regulations often require chaining lookups across sources.
persistent memorymulti-turnshared context
Deployment
Fully Dockerised — reproducible anywhere
The entire system — Hermes runtime, both agents, MCP tools, and the Ollama model server — runs in Docker. A single docker compose up starts the full stack. This means the workflow runs identically on a developer laptop, a trade analyst's workstation, or a cloud VM without environment configuration.
Dockercomposereproducible