# LLM agent

An LLM agent is a system that uses a large language model to decide what to do next toward a goal. It plans, calls tools such as APIs or search, reads the results and repeats until the task is done or it needs a person.

## How does an LLM agent work?

An LLM agent runs a loop. A plain model call takes a prompt and returns text once. An agent keeps going: it decides on a step, takes it, looks at what happened and decides again.

Each turn of the loop has four parts:

1. **Plan.** The model reads the goal, the conversation so far and the tools it has, then picks the next step. For a hard task it may write out a short plan first.
2. **Call a tool.** It emits a structured tool call (an API request, a database query, a search) through function calling.
3. **Observe.** The application runs the call and feeds the result back into the model's context.
4. **Decide.** The model calls another tool, asks the user a clarifying question, or decides the goal is met and replies.

## What is the architecture of an LLM agent?

An LLM agent has five components. The model gets the most attention, but the other four usually decide how well the agent works:

| Component | What it does |
|---|---|
| Model | Reasons over the context and chooses each step |
| Instructions | Set the role, the rules and when to use each tool |
| Tools | The actions and data the agent can reach |
| State and memory | The conversation, intermediate results and anything kept between sessions |
| Guardrails | Permissions, confirmations, step limits and fallbacks to a person |

When an agent fails, the cause is often in the last four: vague instructions, an unclear tool description, missing state, or no limit on how many steps the agent can take.

## What is an example of an LLM agent?

Say a user of a project-management tool writes: "Set up next week's sprint with every open bug tagged checkout, assigned to whoever owns that area."

The agent plans three steps. It calls a search tool for open bugs tagged checkout and gets twelve back. It calls a lookup tool to find the owner of the checkout area. It sees one bug has no estimate, so it asks the user whether to include it. Then it calls the create-sprint tool, adds the issues, sets the assignee and reports what it did, with a link to the sprint.

No single call there is hard. The value is the agent holding the goal across steps and reacting to what each result shows.

## What does it take to run an LLM agent in a SaaS product?

Three things separate a demo from something users trust. Tools map to the product's real APIs, so the agent does what a user could do in the UI. Every call runs with the signed-in user's permissions. And the team can see each conversation, each tool call and each outcome, so they can fix the gaps users hit.

Foldspace's Product Agent follows that pattern: it answers, navigates and runs only [the actions a team has defined](https://docs.foldspace.ai/privacy/llm-governance/), calls the product's existing backend APIs and acts with each signed-in user's access, while Conversational Analytics gives the team each conversation, its outcome and the gaps to fix.

## Learn more

- [Product Agent](/platform/product-agent)
