Skip to content
Changelog

A paused run continued in the background no longer repeats its tool call

October 1, 20261 min read

When an Agno agent or team resumes a human-in-the-loop run with background=True and stream=True, the model now sees the paused tool call once. A background continue marks the run RUNNING before it rebuilds the messages, and history only skipped runs marked PAUSED, CANCELLED, ERROR or REGENERATED. So the paused turn also came back as history, with its tool call but no result, and OpenAI Chat Completions refused the request:

An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'.

The AgentOS UI sends both flags on every continue, so any agent or team with add_history_to_context=True hit this on confirmation, user input and external execution.

Real output of the messages Agno builds when a background continue resumes a confirmed tool call. Before: Hi, the assistant's greeting, then "Delete old.log" and the assistant's tool call call_1 appear twice, the first copy with no tool result, followed by the tool message "Deleted old.log". Now: Hi, the greeting, "Delete old.log", the tool call call_1 once, and the tool message "Deleted old.log".

Agno now finds the continued run by its id, whatever status it has stored, and leaves it out of history before applying num_history_runs and num_history_messages, so earlier turns still reach the model. Thanks to rodrigocoliveira, who found the root cause.

See the cookbook, and learn more about human-in-the-loop and background execution in the documentation.

Frequently asked questions

A background continue marks the run PENDING and then RUNNING before it rebuilds the messages, and history only left out runs by status. The paused turn came back as history with no tool result, and Chat Completions rejected it. Agno now leaves the continued run out of its own history by run id.

Confirmation, user input and external execution, for agents and teams, whenever the continue used background=True and stream=True with add_history_to_context=True on a model that replays the conversation, such as OpenAIChat.

Yes. Agno removes only the continued run, before it applies num_history_runs and num_history_messages, so earlier turns in the session still reach the model.

Shipped around the same time