Open-Source AI Agents: What They Are and Which to Use
An AI agent is a model in a loop that can call tools. Choose the type of tool before you choose the name.
Key takeaways
- An AI agent is a model in a loop that can call tools. A chatbot only answers; an agent takes steps toward a goal.
- Open-source options fall into two groups: frameworks you build with, and ready-made agent apps you run. Pick the group before the name.
- Most agent failures come from unclear tools and missing limits, not from the model being too weak.
What an AI agent actually does
A chatbot takes a message and returns a reply. An agent is given a goal and works toward it over several steps. It decides what to do next, uses a tool, reads the result, and repeats until it finishes or gets stuck.
The basic loop has four parts. The model reads the goal and the history so far. It chooses an action, such as searching a database, running a command or calling an API. The tool runs and returns a result. The result goes back into the model's context, and the loop continues. Everything interesting about agents, including their reliability problems, comes from that loop.
This is also why agents differ from retrieval. A retrieval system fetches information once, while an agent decides when and how often to use its tools. If you are still choosing between the two, read AI agents vs RAG first.
Why open source matters here
Open-source agent tools let you read the code that decides what your agent does, change the prompts and tool definitions, and run the whole system on your own hardware. That matters when your data is private, when a vendor's pricing changes, or when you need to explain exactly how a decision was made.
The trade-off is effort. Hosted products handle logging, retries, permissions and updates for you. With open source, you own those jobs. Budget for that work before you commit.
The main types of open-source agents
| Type | What it is | Best for |
|---|---|---|
| Agent frameworks | Libraries for building your own agent loop, such as LangGraph, CrewAI, AutoGen and smolagents | Custom workflows where you need control over each step |
| Coding agents | Ready-made apps that read a repository, edit files and run tests, such as OpenHands | Developer tasks with clear success checks |
| Local assistant stacks | Combinations of a local model runner, such as Ollama, with a tool-calling layer | Private, offline or low-cost experiments |
Names and features in this space change quickly. Check each project's documentation and release notes before you adopt one, because a framework that was popular last year may now be superseded.
How to choose one for real work
Start from the job, not the tool. Ask four questions before you install anything.
- How many steps does the task really need? If the answer is one or two, a single prompt with a function call is simpler and more reliable than an agent.
- Can you check the result automatically? Agents work best when a test, a schema or a rule can say whether the output is correct.
- Where must the data live? If it cannot leave your network, you need a stack that supports local models from the start.
- Who will maintain it? A framework needs developers. A ready-made app needs someone who can configure it and watch its logs.
Build the smallest agent that does one task end to end. Add tools one at a time, and only after the previous one works reliably.
Running an agent on your own hardware
You can run much of an agent stack locally. The model runs through a local server, and the agent calls it as if it were a hosted API. Smaller open models handle simple tool calls well, but they struggle more with long plans, so expect to keep tasks short and specific.
Hardware sets the limits. A graphics card with 8 GB of memory can run small quantised models comfortably, as covered in our local LLM setup guide. Larger models need more memory, and running them slowly can make a multi-step loop frustrating to watch.
Keep control: permissions and limits
Treat every tool as a permission. An agent that can send email, delete files or spend money will eventually do the wrong thing with that access. Grant the smallest set of tools, and require approval for anything irreversible.
- Set a step limit. Stop the loop after a fixed number of actions so a confused agent cannot run forever.
- Log every tool call. When something goes wrong, the log is the only way to find which step caused it.
- Run risky actions in a sandbox. A container or throwaway folder limits the damage from a bad command.
- Keep secrets out of prompts. Store keys in environment variables and pass them to tools directly.
Common failure modes
Do not assume an agent is finished because it says so. Agents often report success before verifying the result. Check the output yourself or with a test.
- Vague tool descriptions. If the model cannot tell when to use a tool, it will guess. Write each description as a short instruction with an example.
- Loops that repeat the same action. Detect identical consecutive calls and stop them.
- Context overflow. Long tool outputs fill the context window. Trim or summarise results before feeding them back.
- Trusting tool output blindly. A web page or file can contain text that tries to change the agent's instructions. Treat tool results as data, not commands.
A simple way to start
- Pick one repetitive task, such as summarising a folder of notes into a weekly report.
- Write the steps by hand first. Only automate what you already do correctly.
- Give the agent two or three tools, such as reading files and writing a summary.
- Add a step limit, a log, and a check that the report exists and is not empty.
- Run it on a copy of your data for a week before trusting it with the real folder.
Once that works, add one tool at a time. Each addition is a new place where things can break, so test it separately before you combine it with the rest.
Open-source AI agents are useful when you know what you want them to do and how you will check their work. Start small, keep the permissions tight, and let the logs teach you where the loop needs work.
If your task needs one good answer rather than many steps, a plain AI assistant is simpler and more reliable than an agent. See the AI assistant guide for how to choose one.
Frequently asked questions
What is the difference between an AI agent and a chatbot?
A chatbot replies to a message. An agent is given a goal and takes several steps, using tools and reading their results, until the goal is met or it gets stuck.
Are open-source AI agents free to use?
The software is usually free, but running it costs money in compute, hardware, electricity and the time to maintain it. Hosted model APIs are a separate cost if you use them.
Can an open-source agent run without an internet connection?
Yes, if you run a local model and keep the tools limited to local files and services. Smaller local models handle short, specific tasks better than long multi-step plans.
How do I stop an AI agent from doing something harmful?
Grant only the tools it needs, require approval for irreversible actions, set a maximum number of steps, log every tool call and run risky actions in a sandbox.