Lab: Trace one turn#
Goal#
Run a chat that triggers a tool call, then map the runtime path onto concrete symbols in the repo.
Prereqs#
- Working
hermeschat (Install and first chat) - Optional but recommended: a local clone of hermes-agent for reading source
- Tools that can run commands/files enabled (default terminal/file toolsets)
Steps#
- Start Hermes and ask something that needs a tool, for example:
- “Show my current working directory using your tools.”
- or “List files in the current directory.”
- Watch the UI: you should see a tool invocation (name + args) before the final answer.
- In the repo (read-only), open in order:
agent/conversation_loop.py— find the loop that calls the provider withtools=model_tools.py— findhandle_function_call- The tool’s module under
tools/(for example terminal/file tools) — findregistry.registerand the handler
- On paper, write the message roles you expect after one tool round:
user→assistant(withtool_calls) →tool→assistant(final)
Expected outcome#
- At least one tool call visible in the session
- A short notes file (mental or markdown) listing: loop file → dispatch function → handler module
- Role sequence matches strict alternation rules
Verify#
- Tool name you saw in the UI appears in
toolsets.pyor an enabled toolset - You can point to
handle_function_callas the bridge from model → handler - You did not need to edit any core file
Common pitfalls#
- Asking a pure trivia question that never calls tools — nudge the prompt toward filesystem/shell
- Reading only
run_agent.pyand missing that the loop lives inconversation_loop.py - Confusing “tool appeared in UI” with “tool is in
_HERMES_CORE_TOOLS” — check the active platform toolset
Stretch#
- Repeat with gateway messaging once CLI works (
hermes gateway setup+ Telegram/Discord). Compare entry points using Data flows. - Official Telegram path:
website/docs/user-guide/messaging/telegram.md