Hesham Elmahdy

The basics: how AI agents work, in plain words

Short pages that explain the ideas behind AI agents. Each one starts with the short answer. If the subject is new to you, read them in order.

  1. 1What is an AI agent, and how is it different from a chatbot?A chatbot answers your question and stops. An agent is given a goal and works towards it: it decides its own next step, uses tools such as your email or your business system, looks at the result, and carries on until the job is done or it needs you. The real difference is who decides the next step.
  2. 2What is a language model, and why doesn't it know my company?A language model is a program trained on a very large amount of text, learning to predict what comes next. That is how it learned to write, summarise and reason. But your contracts, prices and clients were never in that text, and its knowledge stops at a fixed date. Whatever it needs to know about your company, someone has to give it.
  3. 3Why does AI sometimes make things up?Because a language model is built to produce a likely answer, and the way models are trained and tested rewards a confident guess more than an honest "I don't know". The industry calls these invented answers hallucinations. They come from how the model works, so you deal with them through the way you design the work, not by hoping the next model will be free of them.
  4. 4What is a context window, and why does my AI agent forget?The context window is everything the model can see while it works on your request: its instructions, the documents it was given, the conversation so far, and its own answer. It is the model's working memory. It has a fixed size, and as it fills up, the model pays less careful attention to what is in it. What falls outside it, the model does not know.
  5. 5How does an AI agent use tools like my email or my business system?The model itself cannot open anything. It can only ask. When it needs data or an action, it writes a structured request; your software receives it, carries it out, and hands back the result. So what an agent can do in your company is decided by the tools you give it, not by the model.
  6. 6Should I train the AI on my company's data, or give it the data when it answers?For knowledge about your business, give it the data when it answers. This method is called retrieval: the agent first searches your own documents, then answers from what it found. Training the model further on your data, called fine-tuning, is in my view better suited to shaping how it writes and behaves. A 2023 study found it a weak way to teach it new facts.
  7. 7Why do the instructions I give an AI agent matter so much?Because the agent knows nothing about how your company works except what you tell it. Its instructions, often called the prompt, are its job description. Clear instructions that explain the reasons behind them produce consistent work. Vague ones produce the agent's best guess at what you meant.
  8. 8When should an AI agent stop and ask a person?Before any action that is hard to undo or that commits the company: sending, paying, deleting, signing, or changing a record that others rely on. Below that line, the agent can work alone and report what it did. Deciding where that line sits is the leader's job, and it should be written down before the agent starts.

Glossary