Connecting the agent to the outside world: configuring OpenAI, Azure OpenAI, and other providers; integrating web search, database query, API fetch, and file system tools; plus safety considerations for every tool call.

In episode 5 you designed the system prompt, task instructions, and response formatting through the agent profile in agents/. So far Hermes is only good at rhetoric — it cannot yet touch the real world. This episode is the point where your agent "comes alive": connected to an LLM provider and equipped with tools to take action.
The roadmap for this episode has three parts: first, connecting OpenAI, Azure OpenAI, or another provider; second, integrating web search, database query, API fetch, and file system tools; third, covering the safety considerations you must understand every time the agent calls a tool.
Hermes is designed to be provider-agnostic: one same interface is used for any model. Provider configuration lives in hermes.config.ts, and Hermes reads credentials from environment variables that are automatically loaded from .env.
export default defineHermesConfig({
model: {
provider: "openai",
model: "gpt-4o-mini",
apiKey: process.env.OPENAI_API_KEY,
temperature: 0.4,
maxTokens: 4096,
},
tools: {
registry: true,
directory: "./tools",
},
});For Azure OpenAI, replace the model block to use Azure's endpoint, API version, and deployment name — because Azure has its own deployment structure. The same pattern applies to other providers such as Anthropic or open-source models via an OpenAI-compatible endpoint.
model:
provider: azure
model: gpt-4o
azureEndpoint: "https://belajar-hermes.openai.azure.com/"
apiVersion: "2025-08-01-preview"
deployment: hermes-deploymentThe key to all of this: .env must contain OPENAI_API_KEY or AZURE_OPENAI_API_KEY, and that file must be in .gitignore. To check which provider is active and whether its credentials are valid, run hermes doctor.
Info
Switching providers does not require changing agent code. Just change the model block as long as the tools in use stay the same. This is the advantage of Hermes's provider abstraction.
Tools in Hermes are declared in the agent profile, alongside the persona and capabilities you created in episode 4. Every tool has a name, a description, and a permission level that determines when the tool may be executed.
name: support-agent
persona: "Asisten support produk yang teliti"
goals:
- "Menjawab pertanyaan berdasarkan dokumentasi"
capabilities:
- tools
- browsing
tools:
- name: web.search
permission: auto
- name: web.fetch
permission: confirm
- name: db.query
readOnly: true
permission: auto
- name: fs.read
allow: ["./docs", "./kb"]
permission: auto
- name: http.post
permission: deniedNotice the permission levels: auto means the controller executes the tool immediately without asking, confirm means the agent asks for your approval, and denied forbids it entirely. It is this combination that makes the agent powerful yet controlled.
Web tools give the agent access to the latest information that is not in the model's training data. web.search fetches a list of results from a search engine, and then web.fetch reads the content of a specific page to be summarized.
The two work as a pair: the controller has the agent search first, then the agent picks the most relevant link to fetch. Without web.fetch, search results only contain titles and short descriptions. This is a concrete example of tool chaining, which you will study in more depth in episode 10.
For API integration, the http.get and http.post tools call external REST endpoints. Their results are automatically parsed as JSON and injected into the agent context as fresh data.
{
"status": 200,
"data": {
"order_id": "ORD-2026-0142",
"status": "shipped",
"tracking": "JNE-8821"
}
}If the endpoint requires authentication, register the credentials separately in a secret store — never put them directly in the agent profile.
The db.query tool executes SQL against a configured database. Safety first: set readOnly: true so the agent can only run SELECT statements, not INSERT, UPDATE, or DELETE. Hermes rejects write statements while this flag is active.
The file system is also restricted with an allow-list of paths. The agent may read ./docs and ./kb, but cannot touch files outside those. Also restrict the fs.write tool — if it is not truly needed, set its permission to denied.
hermes run agents/support.yml --session order-checkIf all the configuration is correct, you can ask the agent to check an order status and its answer will reference real data from the database.
Giving an agent tools means giving it side effects. There are four principles you must hold on to:
confirm permission so human approval is required.Warning
The safe default for tools that touch data or systems is readOnly, confirm, or denied. Never turn on auto for a tool that could delete data.
In episode 7 we will see how all of these tool calls are recorded — complete with their arguments and results — so you can trace and replay agent behavior.
Episode 6 made your agent no longer blind and mute: the LLM provider is connected through hermes.config.ts, and the web search, database query, API fetch, and file system tools are registered in the profile with their own permission levels. Most importantly, you now have clear safety principles before the agent is given the power to execute.
Key takeaways:
hermes.config.ts; credentials always come through environment variables.auto, confirm, or denied permission levels.web.search and web.fetch work as a pair to read current information.readOnly and path allow-lists.In the next episode 7 we move into Basic Observability & Logging — event logging for conversations, debugging action execution and tool calls, and replaying logs to monitor agent behavior. See you there!