Methodology · what's under the hood

How this demo works

FinanceHermes is a real agent, not a recording. This page explains the layers behind it: Nous Research (who builds the model), Hermes 4 (how the model reasons), the research loop you watch run on the agent page, and the CIBC Investor's Edge Learn library that grounds the free Learn mode.

The lab

What is Nous Research?

Nous Research is an independent AI research lab that grew out of the open-source model community. It is best known for the Hermes family of open-weight language models — post-trained models that emphasize strong instruction following, transparent reasoning, and user steerability — along with widely used open training datasets and research into decentralized model training.

Where most frontier models are closed systems accessed only through an API, Hermes models are released with open weights: anyone can inspect them, run them on their own hardware, or fine-tune them. This demo uses a hosted Hermes model through Nous Research's own inference platform, Nous Portal, but the same model can run entirely offline.

The model

Hermes 4: a hybrid reasoning model

The default model here is Hermes 4 405B, built on Meta's Llama 3.1 405B foundation and post-trained by Nous Research on a large corpus weighted toward explicit reasoning — math, code, logic, and step-by-step problem solving. It has a 128K-token context window.

Three properties of Hermes 4 do the heavy lifting in this demo:

  • Hybrid reasoning. Hermes 4 can choose to deliberate privately inside <think>…</think> blocks before committing to an answer. When deep-thinking mode is enabled, the agent page shows these traces as the italic thinking block — you are literally watching the model reason.
  • Schema-adherent function calling. The model is trained to emit structured tool calls that match a declared JSON schema. That reliability is what lets a two-tool research loop run unsupervised: when Hermes decides to search, it produces a well-formed web_search call, not prose about searching.
  • Steerability. Hermes models are trained to follow the system prompt closely. The finance-research persona, the citation requirements, and the "answer from sources, not memory" discipline all come from a single system prompt the model actually honors.

The loop

Anatomy of one research run

Every run on the agent page follows the same loop — the classic agentic pattern of reason → act → observe, repeated until the model decides it has enough to answer:

  1. Framing. Your question is wrapped in a system prompt that sets the role (financial research analyst), today's date, and the rules: search before asserting, cite sources, distinguish fact from sentiment.
  2. Planning. Hermes reads the question and decides what it needs. Usually that means emitting one or more tool calls rather than answering immediately.
  3. Acting. In Research mode the agent has two live-web tools, both backed by the Tavily search API: web_search (live web search) and web_extract (fetch a page or PDF and convert it to readable text). These hit the live web — results differ day to day, which is the point. Two further tools, learn_lookup and learn_read, search and read the CIBC Investor's Edge Learn library (described below) so answers can draw on its articles and close with "Learn more" reading.
  4. Observing. Tool results are handed back to the model as structured messages. It reads them, and either digs deeper (another search, a page extraction) or moves to answer.
  5. Synthesis. When the model judges it has enough evidence — or the loop hits its budget of 6 steps / ~50 seconds — it writes the final answer, citing the sources it actually read.

Every event in that loop — thinking deltas, tool calls, tool results, the answer streaming in — is pushed to your browser over a server-sent-event stream as it happens. Nothing is pre-computed or replayed.

The library

How the Investor's Edge Learn content was catalogued

The Learn chatbot is grounded in the CIBC Investor's Edge Learn library, captured in three steps:

  1. Enumerate. Starting from the Learn hub page, we read the site's public sitemap and collected every English /en/learn URL — about 100 pages: the three courses (Investing 101, How to trade options, Trading with Investor's Edge) and the articles, videos and guides across stocks, ETFs and mutual funds, fixed income, options, portfolio strategies, structured notes, registered accounts (TFSA, RRSP, RRIF, RESP, FHSA) and platform how-tos. The sitemap matters because the topic pages load their article lists with JavaScript — the sitemap is the complete, crawlable record.
  2. Capture. Each page was fetched and two layers were kept: the page's own <title> and one-line meta description (the searchable index), and the full article body from the page's <main> content, converted to clean markdown — headings, paragraphs, lists, links, tables — with scripts, navigation and page chrome stripped. Every link inside the articles is rewritten from the site's relative /en/… form to an absolute investorsedge.cibc.com URL, so any link the model repeats in an answer actually resolves. The content is © CIBC: answers attribute it and cite the canonical source page.
  3. Serve locally. The index lives in api/learn-library.js behind a keyword-scoring learn_lookup tool; the article bodies live in a generated module (api/learn-content.js) behind a learn_read tool that returns the stored markdown. Both run inside the serverless function itself: no keys, no network, instant — so the chatbot can quote and teach from the articles' real content and link back to the source.

The library is a snapshot (catalogued July 2026). Refreshing it is one command — node dev/build-learn-content.mjs re-fetches every indexed page — plus a sitemap re-crawl when CIBC adds new articles.

The tiers

Freemium: why Learn mode only answers learning questions

The chatbot runs in two modes, and the difference is enforced server-side by the tools each tier is given, not just by prompting:

  • Research — Tier 1, premium. The full live loop above: web_search, web_extract, and learn_lookup, up to 6 agent steps.
  • Learn — Tier 2, freemium. The educational chatbot. It has no web tools at all — any web_search or web_extract call is rejected server-side, so it cannot do open web research even if asked — and the loop is capped at 4 steps. Its only tools are the local library: every answer starts from learn_lookup, reads the relevant article's full text with learn_read, teaches from that actual content, and closes with a "Keep learning" section linking the source pages.

On top of the tool scoping, the Learn-mode system prompt sets the persona: a plain-language investing educator that defines jargon, uses simple worked examples, gives no personalized advice or buy/sell recommendations, and quotes no live prices. Ask it a live-market question — "what moved NVDA today?" — and it will say that live research is a Research-mode (Tier 1) feature, then teach the underlying concept as far as the library allows. That is the freemium contract: learning questions get full answers; market research is the paid tier.

The tier boundary itself is a one-line entitlement check: if a PREMIUM_ACCESS_CODE is configured, Research-mode requests without it are answered in Learn mode with a notice — the seam where a real subscription system plugs in.

The plumbing

Engineering guardrails

  • Serverless, keys stay server-side. The loop runs in a single Vercel serverless function. API keys for the model and search backends live in server environment variables and never reach the browser.
  • Conservative decoding. Temperature 0.4 and a 4,096-token output cap — tuned for factual synthesis rather than creativity.
  • Bounded runs. A hard budget of 6 agent steps and a ~50-second deadline, with per-call timeouts on both the model and the tools. If the deadline approaches mid-research, the agent is asked to wrap up with what it has.
  • Two tool-call dialects. The loop accepts standard OpenAI-style structured tool calls and Hermes' native inline <tool_call>{…}</tool_call> format, so tool use keeps working across providers and serving stacks.
  • Link integrity. Models occasionally invent plausible-looking article URLs. Learn mode seeds the conversation with the library's real matches for the question, and every final answer passes through a server-side check that validates each CIBC Learn link against the library — normalizing real pages and repairing invented or relative URLs to the closest real article before the answer renders.
  • Failures degrade gracefully. A bad key, a missing model, or a rate limit produces a plain-language error card — with the upstream detail attached — instead of a crash.

The caveats

Limitations, honestly stated

  • The agent answers from what it finds on the live web in under a minute. Search results vary in quality and freshness; a thin news day yields a thin answer.
  • Language models can misread a source, over-weight a headline, or blend sentiment with fact. Citations are provided precisely so you can check them.
  • This is a demonstration of agentic AI methodology, for research and education. It is not investment advice, and no output here should be treated as a recommendation to buy or sell anything.