search_company finds the ticker symbol for a company name, and get_stock_price returns the latest price for a ticker. The main model gets one tool, ask_stock_agent.
HOW THE PIECES CONNECT
- The main model sees the Hermes system prompt, the Hermes tools, and
ask_stock_agent. It does not see the stock tools or your agent’s system prompt. - Your fine-tuned model sees only the requests that the subagent sends: the system prompt from your training data, the stock tools, and the subagent’s own history. It does not see the Hermes system prompt, the Hermes tools, or your conversation with the main model.
Hermes also has built-in subagent delegation through its
delegate_task tool, and delegation.model can send delegated tasks to another model. This guide does not use it for your agent. A delegated subagent gets the Hermes system prompt and the toolsets of its parent instead of your training context, and delegation.model sends every delegated task to your model, not only the tasks that it was trained for.BEFORE YOU START
You will need:- An Oumi project.
- Hermes, installed on your machine by following the Hermes installation instructions, with a main model that you already use.
- A personal Oumi API key from User Settings > API Keys.
- The system prompt from your agent’s training data.
1
Train and deploy a tool-calling model
Follow the first two steps of Run your agent as the main model: train a tool-calling model, and deploy it. Copy the model path of the deployment, for example
projects/{project_id}/deployments/{deployment_id}.Save your Oumi API key in a file, for example ~/.config/oumi/api.key, and make it readable only by you:2
Create the plugin directory
A Hermes plugin is a directory in If you use Hermes with a profile, create the directory in that profile’s When you finish, the directory contains five files:
~/.hermes/plugins/ with a plugin.yaml manifest and an __init__.py file. Create the directory, and save the system prompt from your training data in it:plugins/ directory instead, for example ~/.hermes/profiles/work/plugins/stock-agent/.Create ~/.hermes/plugins/stock-agent/plugin.yaml:plugin.yaml
3
Define and implement the tools
Hermes does not run your agent’s tools in this setup. The subagent sends the tool definitions with each request to your deployment, and runs each tool call itself.Write each definition in the OpenAI tools format from its Oumi tool. Copy the Oumi A tool that finds no match returns a result that says so. A tool whose data source fails raises an error, and the subagent sends that error to the model as the tool result. Neither path invents a value.
toolName into name, and copy description and parameters without changes. The model learned your tools from these definitions.Create ~/.hermes/plugins/stock-agent/tools.py:tools.py
4
Write the subagent's tool loop
The subagent does for your fine-tuned model what Hermes does for a main model. It sends the conversation and the tool definitions to your deployment, runs each tool call in the reply, adds the results to the conversation, and repeats until the model answers without a tool call.Create
~/.hermes/plugins/stock-agent/agent.py, and set MODEL to the model path of your deployment:agent.py
5
Give the main model the subagent as a tool
The main model decides when to call Hermes passes the ID of the current session to the handler as
ask_stock_agent from the tool’s description alone. Say what your agent can answer and what it remembers, so that the main model calls it for the right questions.Create ~/.hermes/plugins/stock-agent/__init__.py:__init__.py
session_id, so each Hermes session gets its own subagent. The subagent reads your API key when the main model first calls ask_stock_agent in a session, so a session that never asks your agent does not need the key.6
Enable the plugin and ask a question
Plugins are off until you enable them. Enable the plugin, then start a new Hermes session with your usual model:Hermes adds the tools of a newly enabled plugin from the next session. Ask a question such as “Is Nucor trading above 150 today?”.The main model calls
ask_stock_agent. Your agent calls search_company to find the ticker NUE, then get_stock_price with that ticker, and returns its answer. The main model then answers you from your agent’s reply.Ask a follow-up such as “And how about Apple?”. The main model calls ask_stock_agent again, and your agent answers with the conversation from the first question still in its history.TROUBLESHOOTING
ask_stock_agentfails with429and “Deployment is warming up”: Your deployment uses scale-to-zero and has no warm replica. The subagent does not wait for a cold start. Wait a few minutes and ask again, or set min replicas to 1.ask_stock_agentfails with400and “Invalid model format”:MODELinagent.pyis not a model path. Set it toprojects/{project_id}/deployments/{deployment_id}.ask_stock_agentfails withFileNotFoundErrorforapi.key: The subagent cannot read your Oumi API key. Save the key in~/.config/oumi/api.key.ask_stock_agentdoes not appear in Hermes: The plugin is not enabled, or Hermes did not load it. Runhermes plugins enable stock-agent, then start a new session. To see why Hermes skips a plugin, runHERMES_PLUGINS_DEBUG=1 hermes plugins list.- The main model answers stock questions without calling
ask_stock_agent: The main model does not know when to call your agent. Make the tool’s description more specific about the questions that your agent answers, then start a new session. - Your agent answers from an earlier, unrelated conversation: The subagent keeps its history for the whole Hermes session. Ask the main model to reset the stock agent, so that it calls
ask_stock_agentwithresetset totrue.
WHAT’S NEXT
Run your agent as the main model
Use your fine-tuned model as the model of a Hermes profile.
Inference logs
Review the requests that the subagent sent to your deployment.
Compounding intelligence
Find where your deployed model struggles, and retrain it on targeted data.
Agent harnesses
Learn what an agent harness contains, including subagents.