AI Agent
- In Turkish
- Yapay Zekâ Ajanı
In short
An AI agent is a system that uses an LLM to plan and carry out multi-step tasks by deciding which tools to call, observing the results, and acting again.
What is an AI agent?
An AI agent is software that doesn't just answer a single question but works toward a goal over several steps. It combines a language model with tools, such as web search, a code runner, a database query, or an internal API, and lets the model decide which tool to use next. For example, a coding agent can read files, edit code, run the tests, and keep fixing errors until the tests pass.
Most agents run a simple loop. The model receives the goal and a list of available tools, then either replies with a final answer or requests a tool call with specific arguments, usually as structured JSON. The application runs the tool, adds the result to the conversation, and calls the model again, repeating until the task is done or a step limit is reached. This ability of a model to request tool calls is often called tool use or function calling.
A useful analogy is the difference between a travel guidebook and a travel assistant. A chatbot tells you how to book a flight, while an agent can search for flights, compare prices, and fill in the booking form for you. Agents are used for coding assistance, customer support, research, data analysis, and automating repetitive workflows.
An AI agent is not the same as a chatbot or a fixed automation script. A chatbot only responds with text, and a script follows steps a developer wrote in advance, while an agent chooses its own steps at run time. That flexibility brings risks, so production systems limit an agent's permissions, cap the number of steps, log every action, and ask a human to approve anything important.
Key takeaways
- An AI agent uses an LLM to decide on and carry out a sequence of actions.
- It works in a loop: choose an action, call a tool, observe the result, repeat.
- Tools give the agent abilities such as searching, running code, or calling APIs.
- Agents choose their steps at run time, unlike fixed automation scripts.
- Limit permissions and require human approval for risky actions.
Example
// llm and tools are placeholders for a real model client and your tool functions
async function runAgent(goal: string, maxSteps = 10): Promise<string> {
const messages = [{ role: "user", content: goal }];
for (let step = 0; step < maxSteps; step++) {
const reply = await llm.chat(messages, { tools: Object.keys(tools) });
if (reply.type === "answer") return reply.text; // the task is done
// The model asked for a tool call: run it and feed the result back
const result = await tools[reply.tool](reply.args);
messages.push({ role: "tool", content: JSON.stringify(result) });
}
return "Stopped: step limit reached";
}Readers ask
What is the difference between an AI agent and a chatbot?
A chatbot answers messages with text, while an AI agent can take actions by calling tools, such as searching, editing files, or sending requests to APIs. Agents also work through multiple steps on their own until a goal is reached.
What is tool calling?
Tool calling, also called function calling, is when a model responds with a structured request to run a specific function with specific arguments instead of plain text. The application executes the function and returns the result to the model.
Are AI agents safe to use?
They can be, with guardrails. Give agents only the permissions they need, cap how many steps they can take, log their actions, and require human approval for anything destructive or expensive, such as deleting data or making payments.
Often compared
See also
- LLMAI & Machine Learning, p. 25An LLM is a machine learning model trained on huge amounts of text that generates language by repeatedly predicting the next most likely piece of text.
- PromptAI & Machine Learning, p. 35A prompt is the input text or instructions you give an AI model, such as an LLM, to tell it what task to perform and what kind of answer you want.
- APIBackend & APIs, p. 2An API is a set of rules that lets one piece of software request data or actions from another in a predictable, documented way.
- RAGAI & Machine Learning, p. 38RAG is a technique that makes an LLM answer using relevant documents retrieved at question time, so its responses are grounded in current, specific data.
- HallucinationAI & Machine Learning, p. 23A hallucination is when an AI model, such as an LLM, confidently produces information that sounds plausible but is false, invented, or unsupported by sources.
- Context WindowAI & Machine Learning, p. 12A context window is the maximum amount of text, measured in tokens, that an LLM can consider at once, including the prompt, conversation history, and its reply.
- ChatbotAI & Machine Learning, p. 8A chatbot is a program that converses with people in text or speech, answering questions or helping with tasks, using scripted rules or a language model.
- Prompt InjectionSecurity, p. 29Prompt injection is an attack on LLM apps where attacker-written text is treated as instructions, so the model ignores its rules, leaks data or misuses tools.
- Context EngineeringAI & Machine Learning, p. 11Context engineering is the practice of choosing what an LLM sees on each call (instructions, documents, tool results, history) so it can do the task reliably.
- EvalsAI & Machine Learning, p. 17Evals are tests for AI systems: a set of inputs with expected results or grading rules, run after every change to measure how well a model or prompt performs.
Spotted a mistake or something missing on this page?Suggest an edit