In short
An agent is given the task of explaining why the ERP records more units of an item than the warehouse system counted in the inventory. Every query it makes depends on the result of the previous one. That sequence has a name: the agentic loop, the cycle in which the system calls the model, carries out the indicated action and feeds the result back into the context until a stop criterion is met. Every turn consumes tokens, and the number of turns depends on the context the agent finds. This is where the Company Brain comes in: the layer that knows the company, meaning what data exists, where it lives, how it relates and who can see what.
The agentic loop is the software mechanism that runs an AI agent. The model produces structured text indicating the next action: call a tool, look up a piece of data, ask a person for confirmation or finish. The code around the model, called the orchestrator, carries out the action, appends the result to the context and calls the model again. The stop rule lives in that code.
In the stock discrepancy case, one turn follows this order:
In one of the turns, the receiving notes show a return received at the warehouse with no entry in the ERP. The model indicates the adjustment, and the cycle pauses until inventory control approves it.
A single call to the model takes one input and returns one output, at a predictable cost. A fixed automation flow runs a sequence written by a person, such as opening a task for the stockroom when the balance diverges. The agentic loop defines the sequence during execution, and the number of model calls is only known at the end. That flexibility hands the project the job of limiting cost and duration.
At every turn, the orchestrator checks explicit conditions for finishing:
Without these criteria, the loop can spin forever. Every repeated turn adds cost without bringing the task closer to its goal.
In most implementations, the model keeps no state between calls. Each turn resends the instructions, the tool descriptions and every result obtained so far. Because the accumulated context goes into every following call, total cost grows faster than the number of turns.
In 2024, Princeton University researchers showed that state-of-the-art agents can be needlessly complex and costly, costing far more than simple alternatives with similar accuracy and argued for measuring cost and accuracy together. In a company, the cost of an agentic loop depends on how many turns the task needs, how much context goes into each turn and which model runs each call.
Some failures show up often in a long agentic loop:
Checking a balance is a read. Posting a stock adjustment changes the branch's accounting result. The cycle's design separates these classes of action and places an approval point before the ones with the greatest consequences. There, the cycle pauses and shows the responsible person the proposed action and the origin of each piece of data.
With raw data, a good share of the turns goes into discovering the basics. The item has one code in the ERP and another in the warehouse. The ERP counts in boxes, and the warehouse counts in units. Every attempt to reconcile this is a paid turn.
The Company Brain delivers that work already resolved. The knowledge graph links the ERP item to the warehouse item and to the receiving notes. The business ontology records each system's unit of measure and the conversion rule. The context arrives via MCP, the open protocol that connects models to data sources, with permissions inherited from the source system. Every query is logged with its source, and with fewer turns some of the calls can run on lower-cost models.
Tools with vague descriptions keep producing wrong calls. A balance posted late in the ERP is still the information the agent receives. Limits and approval points remain the responsibility of whoever designs the cycle.
The starting point is a frequent task with known sources, such as investigating stock discrepancies. Before the first test, the design records the goal, the answer format, the limit on turns and tokens, the stop criteria and the approval point. The log of the turns in each run shows where the agent spent calls on discovery, and that is the first context to resolve.