How to create
your own AI agents
AI agents are changing how we interact with each other and technology.
This guide will explain how they work and allow you to create your own agents.
Scroll down to get started
Introduction
AI agents are an emerging technology and there's some confusion over how people can actually implement them.
This guide will explain what AI agents actually are, how people are already using them to simplify tasks, and how you can do the same.
I've wrote this guide to allow anyone to create their own agents, regardless of how technical they are - so don't worry if this is new for you.
What is an AI agent?
Essentially, this is a bot that can automously solve tasks and decide when it should take an action.
The agent will figure out the steps that are required and then start the process. It can do this completely independently, or it can ask for your feedback on how it should progress.

To power these agents, we use a combination of tools – with Large Language Models (LLM) used to restrict the agent and provide it with the intelligence needed to make decisions.
We also provide them with access to APIs and sections of code, which it can decide to use when necessary.
These are incredibly capable tools and allow us to do things that simply aren't possible with ChatGPT.

What agents can do
I outlined just some of the things that agents can do, but we need to make the agents more capable and provide them with tools.
You can add a wide range of functionality to the agents, such as:
- Executing code
- Web scraping
- Calling APIs
- Query databases
- Search for files
- Or they can even control your computer
When we provide the agents with these options, we are allowing it to decide when each tool should be used. This is quite different to how we have traditionally built software, as we are giving more control to the agent.
Before this, we had to be very specific about how our software should work and use a step-by-step approach - which involved a lot of planning and development time. It also restricted the number of problems that we could solve, since we had to account for every possible scenario.

Agents completely flip this on its head and instead allow us to create more flexible solutions. Of course, we shouldn't use AI agents for every situation, but they're a good choice when we can't predict the user's request.
About the author
Liam McCormick
Senior AI Engineer - Innovation
For the last two years, I've explored the impact of AI agents and created applications that actually use agents in practice. This guide details what I've learnt about the technology and the best practices that you can follow.
How companies are using AI agents
It can be difficult coming up with ideas on how to use agents, since it's a brand new technology.
Below are some examples of how AI agents are being deployed by others:
Company | Use Case | Description | Link |
---|---|---|---|
Klarna | Customer service | Multiple agents are used to handle requests from Klarna's users. The agents are able to handle payments and refunds for customers, with the option to escalate to humans when needed. | Article |
Uber | Software testing | Automatically generates unit test for their huge code base. Two agents work together and create the unit tests needed, along with the dependencies. An executor agent runs all the generated test cases and checks if they passed or not. The fixer agent identifies issues with the failed tests and tries to fix them. Once the changes are made, the executor runs the test again. Refactor and validator agents then ensure that the tests follow Uber's code conventions and are making the correct assertions. | Presentation Slides |
GPT Researcher | Research | Agent that searches the web for info about a specific topic and generates detailed reports. These reports are often several pages long and are broken down into sections. Once the agent is done, you can save the file as a Word document and review it. | Website Code |
Replit | Software development | Develops an initial plan for how the agent should tackle the problem. It then handles the code generation, environment, dependencies, and finally deploys the application. | Article |
Vodafone | Information retrieval | Agent is connected to the company's data on Sharepoint and can analyse thousands of files. It's used by engineers to find information quicker, without having to manually search through the documentation. | Article |
Anthropic | Software development | Code assistant that is run from the Terminal. It's able to understand your codebase, edit files, and create new software features. | Article Code |
Benefits of agents
There are several advantages to using agents when compared to using Large Language Models (LLMs) on their own:
- Incredibly flexible – you can let them work out the steps needed; we don't need to define every stage in the process – like you would when chaining prompts.
- Better results – by splitting a task among several agents, they are more focused than when you only use one LLM.
- Groups of agents – several agents can communicate with each other and decide which agent is best-suited for the task.
- Generate, check, and improve – an agent can generate the first draft, ask other agents to review it and provide feedback, and then use their responses to improve the content.
- Multiple models – you can use a mixture of models from different vendors, such as OpenAI, Anthropic, and Mistral.
- Humans are in-the-loop – you can intervene and tell the agents to go down a different path.

Limitations
As with any technology, there are limitations in what you can do. Many of the issues that we have with LLMs can also be applied to AI agents, since they are underpinned by these models:
- Hallucinations - Large Language Models can occasionally make up information. At first glance, their response looks believable - but it isn't true at all.
- Limited understanding - while these systems can process and generate text that seems intelligent, they don't truly comprehend the meaning behind the words in the way humans do. As a result, it's pretty easy to misdirect and confuse them.
- Biased training data - AI companies have used social media posts and books to train these models, which will often contain different biases. This means the AI can unintentionally reproduce or amplify these biases in its responses.
- Small context windows - LLMs often struggle to maintain context over long interactions and may forget important details that you mentioned earlier in a conversation. To deal with this, I recommend that you divide your task into smaller pieces and assign multiple agents - which will lead to much better results.
Risks
Since AI agents can act on their own and execute code, they also pose new risks that we need to consider:
Human oversight - should a human review the agents' output and be able to stop them?
With most agent frameworks, you can tell the agents to ask a human for advice before they progress.
Misuse - have you added restrictions to prevent your agents being used for another purpose?
For example, users could re-direct your agents and ask them to generate misinformation. Microsoft and AWS offer services that check for abusive prompts and can block them. You should also consider logging how users are prompting the agents, so that abuse can be spotted.
Malicious code - if you have allowed your agents to execute code on a computer, have you ensured that the device doesn't contain confidential information?
For example, users could ask your agents to execute malicious code and wipe the computer - or extract confidential files. You should ensure that the agents are running on a container and can't interact with important files.
Lack of explainability - can you explain and understand how the agents reached a decision?
Do we know why the agents have went off-course and did the wrong action? You should consider logging the messages that are sent between the agents, as this will give you insight into their discussions and why they made a decision.
Looped conversations - have you restricted the number of messages between the agents?
It's incredibly rare, but agents can sometimes get into a loop and constantly message each other. To prevent this, you should use the latest LLMs (avoid GPT 3.5-turbo) and set a hard limit on the number of messages between agents. This will automatically break any message loops that occur and prevent unnecessary costs.
The above isn't an exhaustive list, but they're worth considering to ensure that your project is ready for deployment.

Creating your own agents
Now that we have a better understanding of what agents are, what they're capable of doing, and how others are using them - along with their benefits and limitations - we're in a good position to create our own agents.
When I'm coming up with ideas for agents and developing my own, I follow this process:
Decide on a task you want to automate and simplify
- If you're unsure and need inspiration, you can look at the examples above from other companies
Think about what the agent needs to do
- Does it need to analyse a small or large amount of text?
- Should it have access to tools?
- Do you just need one agent or multiple agents?
Get started and explore different ideas
- The best way to learn is to get started
- I've included a template in the next section, which will help you to try different ideas
Build on your idea and keep improving it
- Learn from techniques and tools that others are using
- Read documentation about the AI agent framework

Getting started
To help you get started and explore some ideas, I've created a template that will guide you through the process - regardless of your technical background.
Plus, it's completely free to use. The notebook will help you to get setup and create your agent within 5 minutes.
In our template, we will create an agent that can generate social media posts and autonomously improve them - until the content matches your brand guidelines.
Here's an example of what the agent can do:

Notice how the agent generated a Tweet for our brand, reviewed the response and decided that the Tweet was too negative, and then immediately improved it for us.
Our agent was able to do all of this within seconds and we didn't have to lift a finger.
To get started, use the link below and follow my guide. I'll explain the entire process and suggest how you can customise the agent for your own work.
