AI systems
How do AI agents work?
An AI agent combines a model with instructions, state, tools, and a control loop. Instead of producing only one response, the system can choose an allowed action, execute it, observe the result, update state, and continue until it reaches a stopping condition.
Step-by-step
- 1
Receive the goal
The agent starts from the user's request plus system instructions, permissions, available tools, and any relevant state supplied by the application.
- 2
Select the next action
The model evaluates the current state and chooses whether to answer, ask for needed information, or invoke one of the actions the application exposes.
- 3
Invoke an allowed tool
When external work is needed, the orchestration layer executes a structured tool call such as a search, database read, code runner, or connected-app action.
- 4
Observe the result
The tool returns data or an action result. The agent can use that observation as new context rather than assuming the action succeeded.
- 5
Update progress
Useful observations are added to the working state, and the control loop decides whether another action is necessary.
- 6
Stop or continue
The loop continues within configured limits until the task is complete, a safety or permission boundary is reached, or another stopping condition applies.
Keep learning
Related visual explainers
How does vector search work?
Vector search converts a query into an embedding and finds stored vectors that are nearby according to a similarity metric. Large systems usually use approximate nearest-neighbor indexes to trade a small amount of recall for much faster retrieval.
How does OAuth 2.0 authorization work?
OAuth 2.0 lets an application obtain limited access to another service without receiving the user's password. This explainer follows the common Authorization Code flow with PKCE used by browser and mobile applications.