Give the agent an execution contract
A chatbot can answer a question without changing another system. A copilot prepares work while a person directs the next step. An agent can select tools and advance a task across several steps within delegated boundaries. These are useful design distinctions, not standardized product labels. The important question is which decisions the application delegates and which effects it permits. A polished conversation reveals little about either boundary.
Consider a hypothetical distributor processing purchase enquiries. The system extracts requested products, looks up stock, prepares a CRM opportunity and asks a salesperson to approve the proposed record. It must not promise delivery dates or send a quotation by itself. That contract defines the allowable inputs, tools, final state and escalation path. The engineering problem is preserving this contract when the model misunderstands a document or an upstream service fails.
Keep the control loop outside the model
A practical execution loop loads authenticated task context, requests a proposed next action, validates it, authorizes it and executes an allowed tool. The application records the result before deciding whether another model turn is necessary. Put a maximum step count, elapsed-time budget and spending limit on the run. A repeated request for the same unsuccessful lookup should terminate or escalate rather than consume an unlimited loop.
- Authenticated intake
- Persist task and input version
- Model proposes typed action
- Validate and authorize tool
- Human approval for CRM write
- Execute idempotently and record result
Use deterministic code for rules that already have a precise answer: stock availability, tenant membership, spending limits and duplicate detection. Let probabilistic generation interpret varied language or propose a summary. Durable workflow replay must use recorded model and tool results rather than reissuing nondeterministic requests inside replayed control logic. This separation makes a failed run diagnosable and limits the effect of a changed model response.
Tools are narrow application interfaces
Tool calling supplies a proposed function name and arguments; it does not execute business authority on its own. Expose a small operation such as draftOpportunity rather than arbitrary database access. Validate identifiers, allowed fields and business invariants on the server. Resolve the acting user and tenant from authenticated application context, never from a model-supplied tenant identifier. Keep service credentials outside prompts and return only the data needed for the next step.
Shape is only the first validation layer
Structured outputs can constrain a supported response to a schema. A syntactically valid quantity can still be implausible, and a valid customer ID can belong to somebody else. Add semantic checks and explicit refusal handling. Separate extraction evidence from conclusions so the reviewer can see which document passage supported each proposed field. Reject unknown tools and unexpected arguments rather than trying to repair a dangerous request silently.
Persist state that explains the decision
Short-term agent state contains the task status, input versions, completed tool calls and pending approvals. Long-term memory is a different product decision: decide what may be retained, who can read it and when it expires. A conversation transcript is neither a reliable ledger nor an authorization system. Store business facts in their owning systems and reference them by stable identifiers. Recheck mutable facts before committing a consequential action.
Bind an approval to the exact proposed operation, arguments and relevant record version. Show a human the customer, affected fields and source evidence. If the proposal changes after approval, invalidate the approval and request another review. Give approvals an expiry and verify the approver still has permission when resuming. A vague instruction to continue should not authorize an entirely new operation produced several steps later.
Recover without repeating the business effect
Background processing moves lengthy work out of the browser request. A durable orchestrator checkpoints progress and resumes after a worker restart or a delayed approval. It does not make external side effects exactly once. For the CRM operation, derive a stable idempotency key from the task and intended business action, enforce uniqueness in an appropriate store and record the remote record ID. Reconcile ambiguous outcomes before attempting another write.
Retry transient transport failures with bounded exponential backoff and jitter. Do not retry invalid permissions or a rejected business rule as if waiting could fix them. If a timeout occurs after the CRM accepted the write, first look up the operation result. Use explicit failed, awaiting-review and completed states, plus an operator queue for unresolved runs. Compensation might close an accidental draft; it cannot reliably undo a message somebody has already read.
Evaluate trajectories and intervention cost
An agent evaluation should inspect the sequence of actions, not just the final prose. Include conflicting product codes, malicious instructions inside an attachment, expired approvals, duplicate messages and a crash immediately after an external write. Check whether the correct tool was selected, whether unauthorized actions were blocked and whether a resumed task preserved its original boundaries. Keep representative examples separate from prompt-development examples to reduce accidental overfitting.
Correlate model turns, tool calls, workflow transitions and approvals with a task ID. Track completion quality, unnecessary tool calls, human correction effort, latency and cost per accepted task. Redact sensitive arguments from logs and define retention limits. Traceability helps explain why the system acted, but a long chain of generated reasoning is not a trustworthy audit record. Record the actual inputs, decisions and effects that the application can substantiate.
Choose where autonomy should stop
Autonomy is inappropriate when the business cannot bound the effect, verify the outcome or recover from a mistake. High-impact decisions may need a deterministic workflow and accountable human decision-maker throughout. A system that drafts an internal opportunity can be useful even if it never sends a customer-facing message. Deploy in shadow mode first, then allow a narrow reversible operation, and expand only against an explicit acceptance standard.
For businesses in Toronto and across Canada, the practical procurement question is who owns the operational contract after launch. Ask for the permission model, failure queue, evaluation set and rollback procedure alongside the demo. Scalera Agency can help scope AI integrations around those boundaries. A smaller agent with an understandable recovery path is often easier to operate than a general assistant whose authority nobody can explain.