A Practical Guide to AI Agents: Three Budget Pools and the Foreman Pattern
Working with AI agents effectively requires more than just prompting—it requires treating model calls, tool invocations, and verification steps as a budgeted resource. This guide introduces a three-pool budget model (planning, execution, and acceptance) for managing agent workloads, and explains the "Foreman Pattern," a coordinator architecture in which a main unit handles goals and decisions while bounded subtasks are delegated to executors. It covers how to decide between conversational Q&A and task execution, how to reduce waste in each pool, when the foreman pattern saves resources versus when it adds overhead, five engineering measures for conserving quota, and how to build a sustainable execution loop with clear boundaries and evidence-based acceptance.
1. First, Classify the Need: Do You Want an Answer or a Deliverable?
When using AI for development tasks, distinguish between two kinds of needs: getting an answer, and getting work done.
Conversational assistants are centered on single- or multi-turn Q&A. They are well suited for explaining concepts, analyzing error messages, organizing information, and generating local text. The user asks; the system responds; the user is responsible for execution and judgment.
Agents, by contrast, are goal-centered. Given the necessary tools, permissions, and runtime environment, an agent can form a plan, read relevant materials, perform operations, check results, and adjust its next steps based on feedback. Its value is not merely generating content, but organizing multiple steps into a trackable workflow.
For example, “explain why this validation logic fails” is a Q&A task, while “locate the cause of the validation failure, fix the logic, add tests, and submit a change summary” is task execution. The latter requires managing working state and handling tool returns, runtime exceptions, and acceptance checks.
That said, agency does not mean unconstrained autonomy. The more complex the task, the more you need to define deliverables, operational boundaries, and stop conditions. Without these constraints, the system may keep investigating and repeatedly modifying things without ever being able to demonstrate that the work is complete.
So the choice should not be based on how long the question is, but on whether cross-step execution is required and whether the result can be accepted against explicit criteria.
2. Three Budget Pools: Build a Budget Model, Don’t Guess Product Rules
“Quota” may refer to request counts, input/output token volume, model invocation budget, tool call limits, concurrency limits, or compute resources. Rules vary across systems, and you cannot assume that quota is shared between a chat interface, an agent interface, and an execution environment.
For task design purposes, this article divides resources into three logical budget pools:
| Budget Pool | Primary Use | Common Consumption Sources | Optimization Focus |
|---|---|---|---|
| Planning pool | Understanding requirements, decomposing tasks, deciding the route | Long-context analysis, comparing approaches, repeated clarification | Narrow the problem scope; lock in goals early |
| Execution pool | Doing the concrete work per the plan | Content generation, tool calls, file modifications, batch processing | Use deterministic operations; limit task size |
| Acceptance pool | Checking results, locating defects, deciding whether to deliver | Testing, result comparison, quality review, rework | Set objective criteria; check key risks first |
This is a generic budgeting method. It does not imply that any service actually provides three separate accounts, nor that fixed conversion rates exist between them. In practice, you must map these three activity types onto the resources your system can actually observe and limit.
The point of a budget model is to turn “consumption is too fast” into a diagnosable question: is the planning stage changing direction repeatedly? Is the execution scope too large? Is acceptance generating heavy rework? Only by separating the sources can you take effective action.
3. Planning Pool: Use a Few High-Value Decisions to Prevent Later Waste
The goal of planning is not to produce the longest possible plan, but to reduce uncertainty in the execution phase.
An effective task plan should answer at least six questions:
- What is the final deliverable?
- What may be modified?
- What must not be modified?
- Which steps have sequential dependencies?
- What criteria determine completion?
- Under what circumstances must the work stop and request confirmation?
Take “batch-normalizing configuration files” as an example. The task cannot simply be described as “tidy up the configs.” A reliable specification should include the target directory, field rules, retention requirements, exception handling, and the output format.
If these details are left undefined, the agent may first reformat the files, then re-interpret field semantics, and finally redo everything because the acceptance criteria changed. That waste stems not from model capability but from incomplete task definition.
The planning phase should also include a necessary investigation of the environment—but a bounded one. Reading the directory structure, relevant documentation, target files, and direct dependencies is usually enough; do not load the entire project into context by default.
A useful approach is a “two-tier plan”:
- Tier one describes the overall goal, phase breakdown, and acceptance criteria.
- Tier two expands only the concrete steps of the current phase.
This avoids spending reasoning effort on later tasks that haven’t been confirmed, while preserving overall direction.
4. Execution Pool: Send Deterministic Work Back to Deterministic Processes
The most common waste in execution is repeatedly asking the model to re-understand work that could be done by fixed rules.
Questions like “is this field missing,” “does the file count match the requirement,” “is this value out of range,” or “are there duplicate records” can usually be checked with explicit rules. The model is better suited for parts where rules are incomplete, semantics are ambiguous, or judgment must be synthesized.
A sound execution flow has three steps:
First, let the model identify rules and exceptions. Second, convert explicit rules into repeatable processing steps. Third, return only the exceptions that rules cannot resolve to the model for analysis.
This division of labor doesn’t mean every task requires a script. For small, one-off work, manual confirmation or a simple tool operation may be more appropriate. The key is to avoid adding complexity for the sake of “automation” itself.
Execution tasks should also control granularity. A subtask should ideally have clear inputs, a bounded modification scope, and an independent output—for example:
- Check configuration fields in a specified directory;
- Fix a single located edge case;
- Add tests for a set of well-defined behaviors;
- Summarize the exception records from one run.
“Fully optimize the entire project” has no stable boundary and easily leads to scope creep.
For batch tasks, process a small sample first, confirm the rules are correct, then scale up. Sample validation doesn’t replace final acceptance, but it exposes misunderstandings early and prevents wrong rules from being replicated at scale.
5. Acceptance Pool: Skipping Checks Only Defers the Cost
When quota is tight, acceptance is the first thing to be cut. Yet unchecked deliverables transfer cost to later debugging, rollbacks, and business fixes.
Acceptance has three levels:
Level 1: Formal correctness. For example, do the files exist, does the structure match the requirements, are all required fields present. Automate these checks wherever possible.
Level 2: Behavioral correctness. Do normal, abnormal, and boundary inputs produce expected results? For development tasks, don’t just verify “the program runs”—check whether the change broke existing behavior.
Level 3: Requirement correctness. Does the deliverable actually solve the user’s stated problem? A change may pass all tests yet miss the requirement; a report may be well-formatted yet omit the key conclusion.
Acceptance budget should not be spread evenly. Prioritize irreversible operations, critical business paths, security-related changes, and high-impact batch tasks. Low-risk, recoverable content can use lighter checks.
Also minimize shared blind spots between the executor and the acceptor. “Independent acceptance” doesn’t necessarily require another model—it can be tests based on pre-defined standards, rule checks, or human review. The point is that you cannot rely solely on the executor’s claim that “it’s done.”
6. The “Foreman Pattern”: Centralized Decisions, Distributed Execution
The “Foreman Pattern” is a coordinator architecture: one main coordination unit owns goals, task assignment, progress aggregation, and delivery decisions, while bounded concrete work is delegated to execution units.
An execution unit can be another model call, a tool pipeline, a rule-based program, or a human operator. It does not necessarily mean launching multiple agents simultaneously.
The core idea is not “spawn more executors,” but reducing repeated understanding and repeated decision-making.
1. The main coordinator keeps the global picture
The coordinator needs to hold the task goal, constraints, dependencies, risks, and overall progress. It decides which tasks can run in parallel, which must wait for upstream results, and which exceptions need escalation.
But it should not continuously ingest all raw logs. Too much detail consumes context and drowns out genuinely important state changes.
2. Execution units receive only the necessary context
An execution unit should receive only the materials needed for the current work—not the entire project history.
A generic task specification can look like this:
Task goal: Check configuration field consistency within a specified scopeInput materials: target files, field specification, exception listAllowed operations: read files, generate a check reportForbidden operations: modify source files, access unrelated directoriesAcceptance criteria: list missing fields, invalid values, and their locationsStop conditions: specification conflicts, or unclear input scopeOutput requirements: summary of conclusions, issue details, unresolved items
Such a specification is not a proprietary interface—it’s an information contract needed to organize work. It reduces the chance that the executor has to guess at the requirements.
3. Returned results must support decisions
Execution results should include status, key evidence, artifact locations, and unresolved issues. When nothing went wrong, there’s no need to replay the entire execution process; when something failed, provide the log fragments needed to locate the problem.
But a summary is not a substitute for evidence. Full logs and artifacts should be retained in a traceable location for later review—not deleted just to save context.
4. Parallelism must respect dependencies
Two tasks are suitable for parallel execution only when their inputs are stable and their outputs don’t conflict. For example, independent checks in different directories parallelize easily, while simultaneous modifications to the same core file may cause conflicts.
Concurrency levels should also be constrained by budget, environment load, and failure-recovery capacity. Parallelism can reduce waiting time, but it does not necessarily reduce total consumption.
7. Why the Foreman Pattern Sometimes Costs More Quota
A coordinator architecture introduces overhead: task distribution, result aggregation, state synchronization, and exception handling. For very small tasks, this overhead may exceed the cost of doing the work directly.
You can reason about it with this conceptual model:
Total consumption ≈ planning consumption+ execution consumption of each subtask+ coordination consumption+ acceptance consumption+ failure-retry consumption
Different resources may not be directly additive. In practice, record call counts, text volume, execution time, and other measurable resources separately; convert them into a unified cost only where an explicit pricing relationship exists.
The Foreman Pattern is a good fit when:
- The task can be decomposed into subtasks with clear boundaries;
- Subtasks need to exchange only a small amount of information;
- Input materials are large, but each executor only needs to read a portion;
- Acceptance criteria are explicit and results are easy to aggregate;
- There are reusable rules or execution pipelines.
For short questions, tightly coupled changes, and work requiring continuous shared context, a single execution pipeline is usually simpler.
8. Five Engineering Measures That Actually Save Quota
1. Control context, don’t mechanically shorten prompts
Deleting necessary constraints can increase misunderstandings and rework. The right approach is to keep goals, boundaries, and acceptance criteria, while removing repeated history, irrelevant files, and stale conclusions.
Phase summaries should state what has been completed, which decisions are currently in effect, and what remains open—so later steps don’t treat an old approach as the current requirement.
2. Cap your retries
Before retrying, diagnose the failure cause. Transient environment errors, missing inputs, and logic bugs each need different handling. Unconditionally repeating the same failing action rarely improves anything.
After a preset number of attempts, stop the automatic loop and submit the failure reason along with the information requiring human confirmation.
3. Do minimal validation before making changes
For batch changes, validate the input scope, the interpretation of the rules, and the sample results first. For high-risk operations, confirm backups, rollback procedures, and approval conditions.
This adds a small upfront cost, but can prevent large-scale rework.
4. Reuse stable artifacts, but verify their validity
Rule summaries, check results, and intermediate artifacts can be reused, but record the corresponding input version or content identifier. Once inputs change, old results can no longer be assumed valid.
When sensitive data is involved, also limit storage scope, access permissions, and retention time.
5. Record rework causes, not just final success
Knowing only that the task completed tells you nothing about whether the budget was reasonable. Record which steps were repeated, which requirements changed, and which tool calls produced no useful information.
These records help improve task templates and reduce repeated consumption on the same kind of problem next time.
9. Building a Sustainable Execution Loop
A practical agent workflow can be organized as follows:
Clarify goals and permission boundaries; complete a bounded investigation; build a phased plan; allocate planning, execution, and acceptance budgets; run a small-scale trial; advance tasks according to dependencies; accept results based on evidence; finally, output the deliverables and open issues.
For operations involving data deletion, permission changes, release deployments, or other high-impact actions, set up human confirmation checkpoints. Execution permissions should follow the principle of least privilege; credentials and sensitive information should not be indiscriminately passed to every execution unit.
Ultimately, quota optimization is not about making every call as short as possible, nor about routing all tasks through a more elaborate collaboration architecture. It’s about reducing ineffective exploration, repeated context, and low-quality rework.
Conversation suits quick explanations; agents suit organized multi-step execution. The planning pool reduces uncertainty, the execution pool produces artifacts, and the acceptance pool proves the results are reliable. Only when task boundaries are clear, coordination costs are manageable, and acceptance evidence is sufficient can the Foreman Pattern truly save resources while improving delivery quality.
