How do AI agents work?
AI agents work by running a loop: the model reads the goal and its context, decides on the next action, calls a tool, receives the result as new context, and decides again. The loop ends when the model judges the task complete or a limit is reached. Everything the agent knows arrives through that context window.
Tool calling is the mechanism underneath. The application sends the model a list of tools, each with a name, a description and a JSON schema for its arguments. Instead of replying in prose, the model can reply with a structured request to call one of them. The application executes the call, since the model itself cannot run code or reach the network, and returns the output as a message. The model then plans the next step with that output in view. Observe, plan, act, observe again: that cycle, repeated, is what makes an agent look like it is working rather than answering.
The context window is the agent's working memory and its main constraint. Every instruction, tool definition, tool result and intermediate thought occupies space in it, so long tasks need strategies: summarizing old steps, keeping notes in a file or store, or handing subtasks to a fresh agent. Good tools return compact, structured results for the same reason. A job search that returns a page of postings with a cursor for the next page fits; one that returns every match at once does not.
Where the tools come from is a separate question, and the Model Context Protocol answers it. An MCP client in the agent's host connects to servers that advertise their tools, so the agent's tool list is assembled at connect time instead of hard-coded. JobsPipe's server exposes search_jobs and detect_company_tech_stack this way, and its search_documentation tool lets the agent look up a filter's accepted values mid-loop, which is the kind of self-correction the cycle above makes possible.
The full treatment is on MCP and AI agents.
Related questions
How does an AI agent work, step by step?
It receives a goal and a list of tools. The model decides whether it can answer or needs a tool. If a tool, it emits a structured call, the application runs it and appends the output. The model reads that output and decides again. When it judges the task done, it writes the final answer. Limits on steps, cost and permissions bound the loop.
How do AI agents work with APIs?
An API becomes a tool when someone wraps it: a name, a description and a schema for the arguments, plus code that makes the HTTP call and returns the response. The model fills the arguments and the wrapper calls the API. With MCP the wrapping is done once on the server side, which is how JobsPipe's search_jobs appears in an agent without custom code.
How do AI agents remember things?
Within a task, through the context window, which holds the conversation, tool results and notes so far. Across tasks, through external memory the agent reads and writes: a file, a database or a vector store. Long tasks combine both, summarizing older steps to free space and storing what must persist outside the model.
Why do AI agents make mistakes?
Most agent failures trace to inputs. Tool descriptions that leave arguments ambiguous, results that are too long to reason over, stale knowledge in the model's training and missing data all produce confident wrong actions. Clear tool schemas, compact structured outputs and a way to look things up, such as JobsPipe's search_documentation tool, remove much of it.
More answers
Query live postings yourself, 1,000 jobs a month free.
Get a free API key