Mastering Agentic Tools
Introduction: From Chatbot to Agent
Welcome to Lesson 4 of the Foundation Course. In the previous lessons, you learned how to configure OpenCode, manage sessions, switch between models, and toggle between Build and Plan agents. Now we explore the most important concept in this entire course: Agentic Behavior.
Most people are accustomed to chat-based AI like ChatGPT or standard chatbots. You ask a question, receive text or code snippets, and then must copy, paste, and run everything yourself. If an error occurs, you copy the error message and paste it back into the chat for another round of suggestions. This back-and-forth can be tedious and slow.
OpenCode is fundamentally different because it is an Agent, not just a chatbot. An agent does not merely talk — it takes action. It has "hands" in the form of tools that allow it to read files, create scripts, edit code, and run commands directly on your machine. Think of the difference between asking a friend for driving directions versus having them actually drive you to your destination. That is the leap from chatbot to agent.
In this lesson, you will learn to shift your mindset from "doing everything yourself" to "managing a capable worker." You describe what you want to happen, and OpenCode figures out how to use its tools to make it happen. We will cover how the agent selects tools automatically, how to point it to specific files using the @ symbol, and how it can even fix its own mistakes when things go wrong.
The Agent's Toolbox
To act autonomously, an agent needs tools. Just as a carpenter has a hammer and saw, OpenCode has a set of digital tools that allow it to interact with your computer. These tools are built into the system, and the agent knows exactly when to use each one based on your request.
Here are the core tools available to the agent:
| Tool | Purpose | Example Use |
|---|---|---|
read | Opens and reads file contents | Understanding existing code |
write | Creates a new file | Starting a new script |
edit | Modifies parts of an existing file | Adding a function, fixing a bug |
glob | Finds files matching a pattern | Locating all .py files |
grep | Searches for text inside files | Finding where a function is called |
bash | Runs terminal commands | Executing scripts, installing packages |
The most important point to remember is that you do not need to tell the agent which tool to use. You never type "please use the write tool." Instead, you simply say "create a file," and the agent intelligently selects the write tool. You say "run the script," and it uses bash. This abstraction lets you focus on your goals rather than the mechanics.
You can ask the agent to describe its capabilities directly in a session:
By understanding that these tools exist, you can be more confident in asking for complex tasks, knowing the agent has the means to execute them. You are not limited to receiving code snippets — you can request complete workflows.
