agent-ops-patterns / gallery / agno map / how it decides
How agno decides
In an ordinary agno agent, the AI model decides at every turn whether to call tools or answer, and plain code runs every tool call it asks for without asking a person unless the developer marked that tool. The run ends when the model replies without asking for a tool, and by default nothing checks that answer, so even a reply cut off by the token limit is reported as completed.
What it does without asking you
-
May a tool call the model issued run, without a person being asked?
Decided by plain code Yes. Code runs every tool call the model makes; it pauses for a person only on tools the developer marked for confirmation, user input or external execution, or on the ask-the-person tools when those are added.
base.py:2431-2575· decision D1 in the full map -
Approve or reject this paused tool call?
Decided by a person Only for a tool marked for confirmation: the run pauses and returns, the developer's code collects the person's yes or no and continues the run, and a missing answer counts as a no.
requirement.py:109-123· decision D2 in the full map -
Should the agent stop and ask the person?
Decided by an AI model Only when the developer adds agno's ask-the-person toolkits; then the model decides when to stop and ask, and the run pauses for the person.
base.py:2484-2518· decision D7 in the full map
How it decides it is done
-
After this turn, is the run over, or does the agent take another turn?
Decided by an AI model The model decides: agno keeps calling it while it asks for tools and stops when a reply has none, with no turn limit by default.
base.py:873-874· decision C6 in the full map -
Before an agent's answer is returned, does anything check that it is right or complete?
Decided by plain code Nothing, by default. The reply that ends the run is returned as completed; a check runs only if the developer adds post-hooks such as guardrails or evals.
_run.py:620-665· decision G1 in the full map -
Is the model's reply complete, or was it cut off or refused?
Decided by plain code The shared run loop does not turn a reply cut off by the token limit, or refused, into anything but a completed run: whatever text came back is the answer. Some provider adapters log a warning.
base.py:873-874· decision E10 in the full map
Limits and memory
-
When an agent keeps asking for tools, when are further tool calls refused?
Decided by plain code No limit by default. With a tool-call limit set, calls past it are not run and the model is told so; the run goes on.
base.py:2431-2445· decision F1 in the full map -
Which earlier messages of this conversation are replayed to the model?
Decided by plain code None by default; with history switched on and a database, the last 3 runs of the session, or the count the developer sets.
_messages.py:1964-1998· decision B4 in the full map -
Has the history grown enough that older turns should be folded into a summary?
Decided by plain code Off by default. A Compaction object folds once replayed history reaches 150,000 tokens; compaction=True folds only after the provider rejects a request as too long.
compaction.py:258-277· decision F4 in the full map
Other judgments
-
When an agent is built without a model, which model answers its requests?
Decided by plain code OpenAI's gpt-5.4 through the Responses API; any model the developer passes wins.
_init.py:89-101· decision A1 in the full map -
When a tool fails, what does the model see, and does the run go on?
Decided by plain code The error text goes back to the model as the tool's result and the model decides what next; the run does not fail.
function.py:2713-2717· decision E2 in the full map -
In a team, which member should take this piece of the work?
Decided by an AI model In the default coordinate mode the team leader's model picks the member for each sub-task from the members' roles and descriptions.
_default_tools.py:706-723· decision H1 in the full map
Three problems in the code
-
1. A reply cut off by the token limit is reported as completed
The run ends as soon as the model replies without asking for a tool, and the shared run loop does not look at why the model stopped (some provider adapters only log a warning). So an answer cut short by the output-token limit, or refused, comes back as the answer with the run marked completed, and the caller cannot tell it from a finished one. An open pull request proposes reporting the provider's stop reason.
Reported; a fix is proposed, not merged (#8630), checked 2026-11-01.
Where:
base.py:873-874,_run.py:665. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) on 2026-11-01; every sentence it found too wide was rewritten or removed, and every rewrite was checked again. -
2. A structured answer that does not parse still counts as success
When the developer asks for a structured answer and the model's text cannot be turned into it, agno keeps the raw text, logs a warning, and still marks the run completed. Code that expects the structured object gets plain text instead unless it checks the type itself. An open pull request proposes an opt-in way to report the failure.
Reported; a fix is proposed, not merged (#10782), checked 2026-11-01.
Where:
_response.py:922-936,_run.py:665. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) on 2026-11-01; every sentence it found too wide was rewritten or removed, and every rewrite was checked again. -
3. Later workflow steps can lose the user's original request
From the second step of a workflow on, an agent or team step receives only the previous step's output, not what the user first asked; the original request reaches it only when the previous step produced nothing. The function's own description says it combines the two, so a step can end up working without the user's question in front of it.
Not reported upstream, checked 2026-11-01.
Where:
step.py:2727-2737. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) on 2026-11-01; every sentence it found too wide was rewritten or removed, and every rewrite was checked again.