How does an agent know when a task is complete?
An AI agent knows a task is complete when the current state satisfies the success criteria defined for the goal.
In other words, the agent should not stop simply because it has taken several actions. It should stop because there is enough evidence that the requested outcome has been achieved.
Start with a clear goal
Completion depends on having a goal that can be evaluated.
For example:
> Find three hotels near the conference venue for under ₹8,000 per night.
This goal suggests measurable completion criteria:
- three hotels have been found
- each is near the required location
- each is within the budget
- enough information is available to present the options
Once those conditions are satisfied, the agent can consider the task complete.
Compare the current state with the success criteria
As the agent works, it updates its state with results from each step.
For example:
Goal: Schedule a team meeting Required participants: 5 Available time found: Yes Calendar event created: Yes Invitations sent: Yes
The agent can compare this state with the expected outcome.
If all required conditions are satisfied, another action may be unnecessary.
Completion should be based on evidence
The agent should use actual results rather than assumptions.
For example:
Action: Create calendar event Tool result: Event created successfully with ID 4821
That tool result provides evidence that the action succeeded.
If the tool instead returns:
> Request timed out.
the agent should not mark the task complete unless it can independently confirm that the event was created.
Different tasks have different completion criteria
For an information task, completion might mean:
- the required facts were found
- the answer addresses the user's question
- important constraints were satisfied
For an action task, completion might require:
- the external action actually succeeded
- the expected system state was reached
For a multi-step task, completion may require several conditions to be true at the same time.
Example
Suppose an agent receives:
> Find out why order A1045 has not shipped and tell me the reason.
The agent might progress through these states:
- Payment checked: successful
- Inventory checked: item unavailable
- Restock information found
- Cause of delay identified
- Explanation prepared
At this point, the requested outcome has been achieved.
The agent does not need to keep checking unrelated systems.
The final response can be part of completion
Sometimes finding the answer is not enough.
If the user asked to receive the result, the task may not be complete until the agent returns it.
For example:
Goal: Analyze the failed deployment and explain the cause.
The agent may identify the cause internally, but it should still deliver the explanation before marking the user-facing task complete.
Completion is different from forced stopping
An agent can stop without successfully completing the task.
For example, execution might end because:
- required information is unavailable
- permission is missing
- human approval is required
- an execution limit is reached
- continuing would be unsafe
These are stopping conditions, but they do not necessarily mean the goal was achieved.
The next article, “What is a stopping condition in an AI agent?”, covers those conditions separately.
Why explicit completion criteria matter
Without clear completion criteria, an agent may:
- stop too early
- perform unnecessary extra steps
- repeat work
- continue indefinitely
- claim success without evidence
Good completion criteria give the agent a concrete way to evaluate progress and decide when successful execution should end.
In short
An AI agent knows a task is complete by comparing its current state and verified results with the success criteria for the goal.
When the required outcome has been achieved and any necessary final response or action has been completed, the agent can stop successfully.
Learning Sequence
AI Agents Curriculum
Explore Related Questions
Deepen your understanding across related AI Agents topics.