Skip to main content

Keep an agent working toward a goal

Normally an agent takes one turn and then waits for your next message. With a goal, you give the chat a completion condition and the agent keeps going by itself: when a turn ends, a separate evaluator model checks whether the condition is met. If it isn't, the agent starts another turn, guided by what the evaluator said is still missing. It stops when the goal is met, when the evaluator judges it impossible, or when a limit is reached.

Use a goal for substantial work with an end state you can check:

  • Fix a module until every test in it passes and the linter is clean
  • Work through a design document until every acceptance criterion holds
  • Split a large file into smaller ones until each is under a size limit
  • Work a queue of issues until it is empty

Set a goal​

In the chat composer, type /goal followed by the condition and press Enter:

/goal all tests in tests/auth pass and ruff exits 0, without changing any test file

Or click the target icon at the left of the composer to open Set a goal, where you can also set the limits.

  • In a new chat, the condition becomes your first message and the agent starts straight away.
  • In a chat that is already going, the goal takes over from the next turn. If the agent is in the middle of a turn, the goal is checked when that turn ends.

A bar above the composer shows the goal, how long it has been active and which turn it is on, for example Goal active · 4m · turn 2/100. Hover over it to see the full condition.

Setting a new goal replaces the current one. A chat has at most one goal.

Write a condition that works​

The evaluator does not run commands or read files itself. It judges only from what the agent has shown in the chat. Write the condition as something the agent's own output can prove:

IncludeExample
One measurable end state"all tests in tests/auth pass"
How to prove it"npm test exits 0", "git status is clean"
Constraints that matter"without changing any test file"

"The code is good" or "the docs are better" won't work well: nothing in the transcript can show them. A condition can be up to 4,000 characters.

Limits​

Every goal has limits, so it can't run for ever:

LimitDefaultNotes
Turns100Set your own with Max turns. Your organisation or the platform may set a ceiling.
Active time120 minutesSet your own with Max minutes. Time while the goal is paused doesn't count.

You can also write a limit into the condition, such as "or stop after 20 turns". The agent reports its progress against it and the evaluator respects it. The limits above always apply as well.

Check, pause, resume and clear​

ToDo this
See the goal's statusType /goal on its own.
Pause itPress Stop while the agent is working. The goal is kept but no new turn starts.
Resume itClick Resume on the goal bar, or send any message.
Clear itClick × on the goal bar, or type /goal clear (stop, off, reset, none and cancel work too).

Ending the chat also clears its goal. Handing the chat off to another agent or team ends its goal too. To keep working toward it, leave Carry the goal over ticked in the hand-off dialog. The new agent starts on the same goal with fresh limits.

When a goal stops by itself​

What you seeWhat happened
Goal achievedThe evaluator judged the condition met.
Goal not achievableThe evaluator judged the condition can never be met in this chat, for example because it contradicts itself or needs something that doesn't exist. The reason is shown.
Goal stoppedA turn or time limit was reached.
Goal pausedThe agent made no progress (it used no tools for several turns), a request was rate limited, a turn kept failing, the evaluator couldn't give a verdict, or the chat's server restarted. Fix the cause if there is one, then click Resume.
Goal stopped by an errorSomething needs fixing before any retry can help, such as an expired connection, an exhausted quota or a model that is no longer available. Fix it and set the goal again.

Short-lived errors, such as a dropped connection, are retried automatically up to three times before the goal pauses.

What the evaluator says​

The evaluator's reasoning is guidance for the agent, so it isn't shown in the chat. To see it, turn on Show Debug Info in the chat settings menu. Each verdict then appears in the transcript, along with the turns the platform wrote for the agent, and the goal bar's tooltip shows the latest reason.

Goals and approvals​

A goal doesn't change your approval settings. If a goal turn calls a tool that needs approval, the agent waits for you as usual, and the goal's time keeps running. To let a goal run unattended, adjust the agent's approval settings first (see Approvals and hand-offs).

Goals from the API and MCP​

Callers without a browser can use goals too:

  • POST /chat/start accepts a goal object (condition, and optionally max_turns, max_minutes, max_tokens). With start_run, the whole loop runs without a websocket.
  • POST, GET and DELETE /chat/{id}/goal set, read and clear a chat's goal; POST /chat/{id}/goal/resume resumes it; GET /chat/{id}/goals lists every goal the chat has had, with each verdict.
  • The platform MCP server has set_chat_goal, get_chat_goal, clear_chat_goal and resume_chat_goal, and start_chat_session takes a goal.

For administrators​

Under the organisation's platform settings you can:

  • turn goals off for the organisation
  • choose the model that evaluates goals (if you don't, FYAI picks a fast, inexpensive model available to the project)
  • lower the turn and time ceilings

Evaluator calls are metered like any other model call and appear in usage as goal evaluations. They are usually a small fraction of what the agent's own turns cost.