Define the job as a controlled loop
A chatbot responds to a prompt; an agent repeatedly observes a situation, chooses an action, and uses the result to decide what happens next. That loop is the important engineering difference. A model call may propose a browser action, but the product must decide whether that action is permitted, execute it, capture the result, and determine whether the task is complete or needs another step. Without those controls, “agent” describes a demo pattern rather than a dependable system.
Start by writing a task contract in ordinary language and then make it testable. Specify the user’s intended outcome, the information the agent may use, the systems it can affect, what counts as success, and what must cause a stop. For example, “prepare a draft reply” can allow reading selected messages and producing text, while explicitly forbidding sending. “Resolve the support request” may permit a draft, but require a person to approve any external response. The contract separates useful autonomy from authority the product has not actually delegated.
Translate the contract into a state machine rather than a long prompt. A minimal workflow can move through accepted, planning, awaiting approval, executing, checking, completed, failed, and cancelled states. Persist the current state, task identifier, relevant inputs, tool-call records, and result summaries. Then a restart can resume or safely abandon work instead of silently repeating an irreversible action. Keep the model’s narrative separate from application state: a confident statement that an operation succeeded is not evidence that the operation did.
Give tools narrow, typed boundaries
A tool is an authority boundary as well as a capability. Its interface should declare accepted arguments, validate types and ranges, identify the user and task context, and return a structured result that distinguishes success from failure. Do not give a model a general-purpose shell, unrestricted browser session, or broad database access when the task needs one specific operation. Prefer a small operation such as “read this approved record” over a credential that can read every record in a tenant.
The distinction between proposing and executing should be explicit. The model can request an operation, but a policy layer should check the request against user permissions, task scope, resource limits, and current state before dispatch. For high-impact operations, have the tool accept a short-lived authorization tied to the exact action and parameters, rather than relying on a broad permission granted at session start. Log the proposed action, policy decision, execution identity, and observed result so that an operator can reconstruct what occurred.
A browser integration illustrates how small the first useful boundary can be. Firefox Devtools MCP exposes inspection and control of Firefox through WebDriver BiDi to compatible assistants. A builder could use that pattern to expose a controlled browser tool, but still needs to define which pages and actions are allowed, how authentication is handled, and whether a page’s contents are trusted. Browser control is not equivalent to safe browsing: visible page text can contain misleading instructions, and a permitted click can still submit or delete something consequential. Firefox Devtools MCP provides a concrete tool boundary to study.
Treat state and memory as product data
Agents need state to carry a task across steps, but “memory” can refer to very different things: transient observations, a task’s durable progress, user preferences, or reusable knowledge. Store each kind deliberately. Transient tool output may be discarded after a task; progress should be recoverable; preferences need user controls and provenance; reusable knowledge needs a policy for freshness and correction. Mixing all of these into one conversational transcript makes it difficult to know what the agent is relying on or to remove an incorrect fact.
For each persisted value, record where it came from, when it was observed, which task or user it belongs to, and how it can be corrected or expired. Avoid keeping secrets in prompts or general memory. A credential should be held by the component that needs it and presented to a tool under an appropriately narrow scope. A task summary can help the model continue, but it should not replace canonical application records such as the approved amount, recipient, or current workflow state.
Multi-agent designs add another state boundary: what one worker can see and what the coordinator trusts. Clawcompany is an example of a system organized around specialist agents, role templates, tools, and shared company or session memory. Builders can examine that composition pattern when work separates naturally into research, analysis, and reporting. Shared memory, however, can spread a mistaken or sensitive result across roles. Define which outputs are provisional, who can write shared facts, and how workers receive only the context needed for their assignment. Clawcompany illustrates that coordination pattern.
Bound retries and make recovery explicit
Retries are not automatically safe. A timeout can mean that a tool never ran, or that it ran but the response was lost. Repeating an operation such as sending a message or placing an order may duplicate its effect. For every tool, identify whether it is read-only, naturally repeatable, or state-changing. Where possible, use an idempotency key tied to the task and intended operation; otherwise, check the external system’s state before retrying. Make retry limits, backoff, and deadline behavior application policy rather than model discretion.
Return structured tool outcomes, including a stable error category, whether the operation may have taken effect, and any recovery action available. A model should not be asked to infer from a vague timeout whether to try again. The workflow can instead enter a state such as outcome-unknown, pause further writes, and request reconciliation or a human decision. Cancellation also needs defined semantics: stopping the agent loop does not necessarily cancel work already accepted by an external service.
Verification should match the action. After a write, query the relevant system or use its confirmation response to check that the requested state change occurred. For computation or structured reasoning, a separate checker can reject results that fail a defined condition. Danus, for example, coordinates mathematical reasoning agents and uses a verifier to gate accepted results before storing them in a fact graph. That is a useful verification pattern for checkable claims, not evidence that independent agents will reliably catch arbitrary mistakes in open-ended tasks. Danus demonstrates a verifier-gated workflow.
Put human checkpoints where authority changes
Human approval is most useful at a consequential boundary, not as a ritual confirmation after every harmless step. Ask for review when an action is external, difficult to reverse, unusually costly, outside the normal policy, or based on ambiguous evidence. Show the proposed action, the relevant inputs, the expected effect, and the reason it needs approval. The approver should be able to reject, edit, or narrow the action; an “approve” button without a meaningful view of what will happen does little to control risk.
Make approval a durable workflow state. Record who approved what, under which parameters, and whether those parameters changed before execution. If the plan changes materially after approval, require approval again. Use an expiry for pending approvals and make the task’s behavior after expiry explicit. For a low-risk task, a user might approve an entire bounded plan; for an action with serious consequences, approval should bind to one specific operation rather than a broad intention.
Voice interfaces make the same issue easy to overlook because conversation feels informal. Jarvis — assistant vocal local combines spoken requests with tool use for tasks such as home automation, PC actions, and web tasks. A builder borrowing that interaction shape should distinguish commands that merely retrieve information from commands that change a device or contact another person. Spoken consent can be misheard or ambiguous; for consequential actions, repeat back the exact target and effect, then require a clear confirmation or a separate interface checkpoint. Jarvis — assistant vocal local is a useful local-assistant example, not a substitute for action-specific consent.
Evaluate the whole system, not just the answer
A model benchmark cannot tell you whether the agent respects tool permissions, recovers from a timeout, or stops when approval is withheld. Build an evaluation set around complete workflows: normal success, malformed tool arguments, stale or contradictory data, denied permissions, rate limits, interrupted execution, duplicate requests, and a user cancellation. For each case, assert both the desired result and prohibited side effects. A task that reaches the right answer by sending an unauthorized message is a failure, even if the final text looks excellent.
Instrument each transition with a task identifier, timestamps, model and prompt version, tool request, policy outcome, execution result, retry count, and approval record. Avoid logging secrets and unnecessary personal data; observability must not become a second uncontrolled data store. Track operational measures such as completion, escalation, tool error, duplicate-effect, and recovery rates, but interpret them in context. A high completion rate can conceal policy violations if the evaluation only counts finished tasks.
Roll out one narrow workflow first. Run it in a sandbox, then in a shadow mode that proposes actions without executing them, and compare those proposals with human decisions. Add live execution only after tests cover the relevant failure modes and a person can intervene. Keep a kill switch for the workflow and a clear route to inspect or reconcile pending tasks. The next step is not to add more tools: it is to verify that the current loop has explicit authority, recoverable state, bounded retries, and evidence for every consequential result.

