
Learn to run Hermes locally, with no account, customize via a system prompt, and build tools—from a chatbot to a document question-answering system and a tool-using agent.
Learn what Hermes is as an open weights language model you run on your own computer, enabling offline, private conversations without company control or subscription fees.
Discover how Noose Research shapes Hermes through alignment, prioritizing user-directed behavior over company rules, with system instructions and evolving versions guiding its responses.
Hermes emphasizes following directions, tool use through function calling, and neutral alignment, enabling private assistants and agents on your own machine with reliable outputs, though it doesn't top standard tests.
Learn how system prompts shape Hermes' behavior by adding a system message to the chat history, and observe how edits to that standing instruction alter responses.
Create a Telegram bot with BotFather and connect it to Hermes on your computer using a Python script and Olama. Maintain chat history for context and chat from your phone.
Master five prompting moves to shape model outputs without retraining. Set examples, role prompts, exact formats, admit unknowns, and reason before answering to unlock fast, cheap results.
Explore few-shot prompting, using two finished examples to shape the model's output patterns and format. See how examples outperform descriptive cues in delivering precise, concise labels.
Use role and persona prompting by adding a single system prompt that defines who the model is, guiding voice and audience.
Provide a labeled template that defines the shape of the answer with named fields and slots for the model to fill, then render a parsable, easy-to-scan output.
Use an opt-out line to reduce hallucination by letting the model respond with a fixed, short refusal when it lacks information. This makes refusals predictable and usable by downstream code.
Learn chain-of-thought prompting by asking the model to work through steps before answering, building on correct reasoning to improve accuracy in multi-step problems.
Learn to manage the context window—the finite text space Hermes sees within token limits—and choose what to include, using the three techniques, since the model has no memory between calls.
discover how stateless models see only the current messages, requiring the full history to preserve facts, as in the Redwood project due March 3rd.
Use sliding window context management to keep only the last turns, dropping older ones to keep cost and speed flat. It contrasts wide and narrow windows and summarizes old turns.
Compress conversations by turning the oldest turns into a brief summary kept as context, then swap the old turns for that one-line fact in future prompts with a system message.
Chunk long inputs by splitting documents into smaller pieces, summarize each in the map stage, and then reduce those summaries into a final, concise overview.
Enforce a schema to extract clean data from Hermes, defining an exact shape with known names and types, since free text breaks pipelines.
Describe the exact shape you want with a schema and set the format to enforce a structured json, ensuring the reply is valid json data.
Build a short program that turns a messy receipt into clean structured data using a predefined schema on Hermes, returning a usable object for apps.
Learn to implement input guardrails that filter requests before they reach the model, allowing only safe, on-topic inputs and blocking unsafe ones.
Implement an output redactor with guardrails to mask personal data, using regular expressions for emails and phones and a model to detect names, applying names first to keep tags intact.
Wrap an assistant with input and output guards to block unsafe requests and redact personal data. The guards log safely before the model answers.
Learn how reasoning models deliberate openly with think tags, revealing their private train of thought before giving the final answer, as demonstrated with DeepHermes.
Explore how a system prompt toggles reasoning mode in the Hermes agent, enabling think tags for step-by-step reasoning or quick answers, demonstrated with side-by-side calls.
Explore the reasoning trace as the model's working, showing restating the problem, naming the ages, forming equations, solving for the son's age, with visibility and checks.
Inspect the latency cost of reasoning in AI models, contrasting plain and reasoning approaches and their time trade-offs. Decide when thinking is worth the wait by examining the father-and-son problem.
Assess when to use reasoning models versus plane models by weighing speed, cost, and the need for full, verifiable working steps, especially on small local models.
Explore how model responses vary due to sampling variance and nondeterminism, and learn to mitigate errors by querying multiple times and voting to reveal a supported answer.
Use self-consistency by asking the same question seven times, collect the answers, and take the most common one to reveal the correct solution through majority vote.
Self-consistency boosts accuracy only when the model is mostly right, and it incurs cost from multiple calls; use it for hard or high-stakes questions, not ordinary queries.
Apply self-consistency to voting by counting discrete, comparable answers such as math results or yes/no, while open-ended tasks resist majority and undermine reliability without countable outputs.
Build a fixed test set to measure your agent's quality across many cases, automate scoring, and compare results after changes.
Learn how to use a language model as a judge to automatically grade answers, verify the marker with Hermes, and turn test results into a score.
Edit the one system line to require step-by-step reasoning and state the final number, then compare the score on the same 10 questions to measure improvement from 2 to 9.
Learn to handle common failure modes in autonomous agent programming by anticipating call failures and mismatched replies, and implement retries, timeouts, and strict error handling to prevent crashes.
Implement a retry wrapper that retries risky calls with a growing pause, and enforces a time limit to avoid hangs, so transient failures still complete.
Catch unreadable model replies with a try around json.loads and return nothing via safeJSON. Retry with a strict structured output so the data always parses.
This lecture explains that LLMs are limited by training data and cannot act on their own, and shows how tools let Hermes access current information by calling user-provided functions.
Explore how Hermes uses a tools list and the tool role to trigger, run, and return function results within a messages list, enabling weather data retrieval via a tool call.
Build a function-calling weather agent with Hermes by wiring a real getWeather function, tool descriptions, and a loop to fetch live weather data.
Create tools that act by writing a note to a file, allowing the agent to remember items and make real changes on disk rather than just fetch information.
Explore human-in-the-loop approval in the Hermes agent guide, showing each action before execution to prevent destructive changes.
Pair an acting agent with a permission gate in a loop, allow instructions, approve each proposed action, and observe the assistant perform safe tasks on your machine.
Build an agent in Hermes that holds multiple tools and learns to dispatch the right tool for weather and math questions using a toolbox and a looping selection process.
Extend the toolset by adding a new define tool that looks up word meanings via a dictionary service; the core loop remains unchanged and uses tool descriptions to route questions.
Build an interactive multi-tool agent with an input loop that handles one clear tool per query, showing tool choices and results on your local machine.
Expose Hermes as an HTTP web service by building a FastAPI server with an ask endpoint that returns Hermes' answers over the web.
Learn to build a browser-based chat front end for Hermes by serving an index.html page at localhost:8000, using fetch to send questions and display answers.
Explore streaming responses (SSE) to show answers live as they are generated, sending pieces to the page in real time and updating the assistant message as it arrives.
Allama reports load time, prompt-reading time, and generation speed, revealing why a local model feels slow and how to fix it.
Learn how to measure model speed using tokens per second, by dividing generated tokens by generation time, and compare models or machines using this baseline.
Demonstrate cold start vs warm model by measuring load times as the model loads into memory. Keep alive to maintain the model in memory and cut cold start latency.
Explore how prompt length drives read time and token cost across prompts. Use lean prompts with targeted retrieval to reduce delay by using relevant passages and limiting context.
Streaming reveals tokens as they're generated, improving perceived speed rather than waiting for a full reply. Enable streaming with a flag, print each chunk, and reduce dead weight in chats.
Turn a Hermes script into a command line tool that reads input and prints output. It becomes callable from anywhere and easily composable with other commands via piping.
Pipe input to a command-line tool that reads standard input and summarizes it. Built in Python, it sends text to Hermes and prints the summary.
Parse commands with flags to perform multiple tasks in one tool. Use a task option like summarize, shorten, or formal with built-in help and error messages.
Learn how to turn a Hermes script into a real command by adding a shebang and executable permission, then placing it on your path for run-from-anywhere access.
Turn text into vectors with embeddings and apply cosine similarity to measure meaning, enabling you to extract the few relevant passages that answer questions from documents using Hermes.
Chunk a document into passages, embed each passage once, and score a question against stored vectors to fetch the best matching passage. The plan has three steps.
Ground answers in retrieval context by embedding and retrieving relevant passages, then answer only from those passages. If no passage covers the question, say you do not know.
Load a document once, embed passages into vectors, and answer many questions from stored passages on your own machine, with honesty about missing content and a looping Q&A interface.
Explain semantic search vs keyword search, showing how meaning-based retrieval uses embeddings to turn text into vectors, enabling you to find notes by concept rather than exact words.
Embed your notes with the gnomic-embed model to produce a fixed-length vector of 768 numbers capturing meaning. Use vector distances to enable semantic search by similar meaning.
Embed the query as a vector, compute its cosine similarity to every note, rate results by meaning rather than words, and rank from highest to lowest scores.
Explore nearest neighbor search by scoring notes against one note's vector rather than a query, revealing related notes and near-duplicates through cosine similarity of embeddings.
Explore semantic search over a folder of text files by embedding each file and the query, then rank by cosine similarity to find notes by meaning.
Turn natural language questions into an sql query using an autonomous agent that learns your database schema and writes correct queries for shop data (customers and orders).
Verbalizing sql results demonstrates how Hermes formats raw rows, phrases them into a single sentence, and uses two model calls around one sql query to answer questions aloud.
Learn how a text-to-sql query agent runs questions locally on your machine via an input loop, keeps your database on disk, and returns plain-english answers.
Discover how pre-training builds a broad base model from vast text, and how fine tuning tailors it with curated examples to follow instructions, as Hermes blends Llama with Noose.
Fine-tuning reshapes model behavior, not its base knowledge stored in pre-training; use it to adjust response style, tone, and how it handles tool calls, while retrieval handles documents.
Discover when fine-tuning is worth the cost, after leveraging prompts and retrieval to shape behavior and facts. Follow a clear rule for deciding when to fine-tune, especially at scale.
Reveal the gap after instruction tuning. Show how preference tuning uses human judgments to select the better answer, including RLHF.
Turn human judgments into a reward model and apply reinforcement learning to push the model toward higher-scoring answers, via two-model comparisons, a reward model, and a feedback loop.
Learn how direct preference optimization trains on preference pairs directly, removing the reward model and reinforcement loop, enabling one-pass, cheaper fine-tuning used by Hermes in open models.
Understand why full fine-tuning of an 8 billion parameter model needs vast memory and server GPUs, and how touching every weight becomes costly.
Explore LoRa, or low-rank adaptation, to fine-tune large models by freezing the base, training a small adapter, and using two thin matrices to steer behavior with minimal memory.
Quantized LoRA combines 4-bit quantization of the frozen base model with training a small LoRA adapter on top, enabling fine-tuning a large model on a single consumer graphics card.
Set up a fine-tuning environment and train a small model on an ordinary processor using LoRa to teach it a pirate speech habit, starting from plain behavior.
Generate a pirate-styled training dataset by using a local model to produce question-answer pairs, save them as piratedata.json, and prepare the data to train a LoRa adapter.
Perform a LoRa fine-tune by training a small adapter on a frozen model, saving an under 2 MB file, with loss dropping from 3.2 to 1.8.
Compare a plain base model with a LoRa adapter loaded to see how fine-tuning changes the model's default behavior while preserving factual accuracy.
Learn how data source and quality shape model behavior across pre-training and tuning. Producing tens of thousands of good examples takes time and money, and points to synthetic data.
Harness synthetic data by prompting a strong model to generate requests and answers, building a fast, scalable training set that covers edge cases. Prioritize cleaning to prevent duplicates and errors.
A curated, cleaner training set beats a larger, messy one, because quality covers the needed range, removes bad examples, and strengthens Hermes on the LLAMA base.
Normalize messy data by mapping inconsistent fields to a single, clean form, starting with date formats, so downstream processes can rely on consistent values.
Normalize dates with an LLM to ISO year-month-day via a toISO function and per-value instruction. It handles month names, ordinals, and numeric dates in a single batch process.
Standardize names by applying a title-case clean function with single spaces, no stray punctuation, producing one clean form that preserves hyphens and apostrophes.
Canonicalize company names by stripping punctuation and suffixes like inc or corp, lowering case, then use a dictionary to group duplicates via exact matches.
Wire three cleaners into a single pass over a messy csv to produce cleancontacts.csv, cleaning every field and writing a tidy file.
Turn a pile of documents into a database table by extracting each document into a structured record, then loading those records so SQL can answer across the entire set.
Define a fixed record schema to extract structured data from documents, producing a consistent title, author, year, and page count that can be loaded into a database.
Load extracted records into a SQLite table with columns matching the record fields, insert each document as a row, and commit to books.db, enabling subsequent SQL queries.
Transform prose into table rows and run ordinary SQL across all documents to answer questions instantly; filter pre-2005 books and group by decade to average pages.
Explore a one-pass extract-load-query pipeline that converts documents into in memory records and a table, then answers questions with SQL, showing who wrote the longest book and when.
Build a reliable writing assistant by creating small, single-call tools that transform text you already have into edited, shorter, better-toned versions. Start with a shortener to reduce wordiness.
Learn how to shorten padded passages into lean text while keeping the meaning using a single rewrite tool that trims filler and keeps the point intact.
Transform text with tone and style transfer, restyling messages into professional or casual registers while preserving meaning and adhering to a length guard for a concise restyled message.
Master a grammar and spelling fixer that corrects spelling and grammar while preserving your voice, delivering clean text with a single instruction and one call.
Put the agent on a schedule to wake up, run its script, and save the output file for the daily digest.
Learn to build a digest agent that turns a day's log into three or four plain bullets, covering what happened and what needs attention in one call.
The agent saves daily digests to dated files in a reports folder, creating a permanent trail for unattended runs. It also prints, with a date-based name that avoids overwriting yesterday.
Schedule the agent to run daily with cron, a built-in macOS and Linux scheduler using five time fields and a command that runs the digest script each evening.
Learn to batch process by giving Hermes a pile of items and running a loop that applies a single item function to each entry, yielding structured results.
Classify a batch of support tickets by category and urgency using a fixed json schema with two fields, looping over the stack to produce a clean, sortable table.
Extract facts from emails into a tidy row by identifying sender name, company, and request, using a fixed JSON shape and per-item extraction loop.
Aggregate a stack of ticket results into a structured dataset by collecting rows with category and urgency, then count, sort by urgency, and export to CSV for actionable insights.
Measure seconds per item and time the batch to predict scale. Guard each call with a try and accept to prevent a single failure.
Build a multi-agent research team that turns a question and your documents into a short, grounded brief, using planner, researcher, and writer roles.
The planner agent breaks a broad question into three short sub-questions, enabling researchers to answer from a single document set and drive the Hermes workflow.
Discover how researchers use retrieval by meaning to fetch passages from documents, answer sub-questions only from those passages, and admit gaps when material falls short, building a grounded Hermes brief.
the writer agent assembles researchers' findings into a grounded, single brief with headings for each point, using only what the researchers found and no new facts.
Orchestrate the planner, researchers, and writer into a single function that runs in order, turning a question into a complete brief and saving it with a permission gate.
In generator–critic loops, a writer drafts an explanation of what an API is, a critic critiques it, and the writer rewrites, turning a rough draft into a clearer beginner explanation.
Use planner agent to break a task into small parts and a worker agent for each part to draft its section titles, then gather the pieces into a finished guide.
A multi-agent content pipeline joins planning, writing, and editing into a single polished piece. Each agent performs a role, passes work along, and scales tasks beyond a single prompt.
Build a study buddy tutor that quizzes you on any topic and grades your answers as you progress, in a personality-driven one-question-at-a-time tutor.
Learn to implement llm-based answer grading using a fixed verdict schema with a short feedback, powered by Hermes, so your program can act on a plain verdict and adapt quizzes.
Adapt the quiz difficulty with a simple easy-to-hard ladder, using verdicts and a two-right-in-a-row streak to raise the level, or reset on a miss within the session.
Persist your study progress across sessions by saving to progress.json. Load it at start to continue where you left off, with score and missed questions preserved.
Deploys the study buddy tutor to Telegram by wrapping the terminal logic into a Telegram bot, enabling chat-based questions, scoring, and progress tracking on your phone.
Evaluate customer questions with a help center by using retrieval scores to judge coverage, set a 0.6 threshold, and route uncertain queries to a human.
The Hermes agent escalates unanswered questions by creating a real support ticket, writing a one-line summary and an identifier, and saving it to tickets.json for human follow-up.
Build a retrieval-backed support agent that scores questions against the help center, then either answers from retrieved passages or escalates by creating a ticket, all within a single handle function.
Note: This course contains the use of artificial intelligence.
This course covers how to build AI agents on top of NousResearch's Hermes, an open-weight model you run yourself instead of calling a hosted API. Everything runs locally through Ollama on Hermes 3 8B, so the course has no API costs and works offline. The code is plain Python with the standard requests and ollama calls, not a wrapper framework, which means you work directly with the model's chat endpoint and see the raw ChatML the model actually receives.
You begin with the runtime: installing Ollama, pulling Hermes, and calling both the native /api/chat endpoint and the OpenAI-compatible /v1 route. You'll look at ChatML directly, including the <|im_start|> and <|im_end|> tokens, the role turns, and how the system prompt steers generation. The course uses apply_chat_template rather than hand-writing tokens, and explains where the two differ.
Function calling is the core of the course. You'll work with Hermes's native tool format, the <tools>, <tool_call>, and <tool_response> blocks, and the official function-calling system prompt. You build an agent that parses a <tool_call> out of the model output, executes a real API, and feeds the result back as a <tool_response> for the model to answer from. Then you cover the easier path through Ollama's tools=[...] parameter and where the JSON parsing tends to break.
For structured output you define schemas with Pydantic, pass the JSON schema into the system prompt, parse the reply, and feed validation errors back for a repair pass. For agents you implement the ReAct loop directly, reason, act, observe, and cap the iterations, and build a multi-tool version with a calculator, a file reader, and a fetch tool. The RAG module builds a local retrieval pipeline with an embedding model, cosine-similarity search over your own document chunks, and a grounded answer that cites the passage it used.
The multi-agent section builds a writer-and-critic loop and a planner that splits a question into sub-questions, sends each to a researcher that retrieves and answers from the source, and passes the findings to a writer. You'll add guardrails that combine regex and a model pass to redact emails, phone numbers, and names, an LLM-as-judge evaluator with a grading schema, and a safe_json retry that falls back to constrained output when a reply won't parse.
The final section is fine-tuning. You cover LoRA and QLoRA and why 4-bit adapters fit in Mac memory, generate a small ChatML training set, train an adapter, and check the trainable-parameter count and the loss curve across epochs. You then export the result and load it back into Ollama so you can run the model you trained. The course closes on the self-hosted Hermes Agent, its memory and markdown skills files, the cron scheduler, and a Telegram connection.
This course is for people who want to understand how agents work at the level of the actual prompt and the actual tool-call parsing, rather than through a framework's abstractions. By the end, you'll have a complete understanding of how modern AI agents actually work under the hood.