Iznad nacrta: projektiranje AI agenata za stvarnu provedbu proizvoda
Most AI demos end at the draft. They generate a plan, a pull request, a customer reply, or a neat summary—and then a person must decide what is true, safe, complete, and worth shipping. That gap is where agent design becomes real engineering.
A useful AI agent is not simply a model connected to a few tools. It is a bounded execution system: it receives a goal, gathers the right context, chooses from permitted actions, records what happened, and knows when to stop and ask for help. The model may provide reasoning and language, but the surrounding architecture determines whether its work is reliable enough to matter.
Start with an outcome, not an impressive conversation
“Build an agent that helps with support” is too vague to engineer. A better goal is: “Classify incoming tickets, retrieve relevant account information, prepare a response draft, and route exceptions to a human.” The second version has visible inputs, outputs, boundaries, and failure states.
The same principle applies to software work. An agent that “fixes bugs” is difficult to evaluate. An agent that “reproduces a labeled issue in an isolated environment, identifies likely affected files, proposes a patch, runs the existing targeted tests, and opens a review-ready change” has an execution contract.
Before choosing a model or framework, define four things:
- Trigger: What event starts the work?
- Success condition: What observable result means the task is complete?
- Authority: Which systems may the agent read, write, or invoke?
- Escalation path: Which uncertainty, risk, or failure requires human review?
This turns agent development from prompt experimentation into product design.
Give the agent a narrow, legible action surface
Agents fail in surprisingly ordinary ways: an ambiguous tool description leads to the wrong query, stale context produces a confident but outdated answer, or a retry repeats a side effect. Broad access makes all of these failures more expensive.
Expose tools as clear domain operations rather than raw infrastructure whenever possible. A tool named create_refund_draft communicates intent and can enforce policy more effectively than unrestricted database access. A deployment agent should request a deployment through a controlled workflow, not receive a general shell with production credentials.
Good tools have predictable inputs, structured outputs, and explicit error states. They should distinguish “nothing found” from “request failed,” and “action queued” from “action completed.” This gives the model enough information to recover sensibly without inventing an explanation.
Design for idempotency before adding retries
Retries are essential in distributed systems, but they can duplicate emails, tickets, payments, or deployments. Any tool that changes state should accept an idempotency key or otherwise detect an already-completed request. The agent can then retry a timed-out call without guessing whether the first attempt succeeded.
{
"ticket_id": "SUP-1842",
"idempotency_key": "SUP-1842-refund-draft-v1",
"reason": "duplicate charge"
}
The durable system, not the model’s short-term memory, should be responsible for preventing duplicate effects.
Separate planning from execution
For multi-step work, it helps to treat a plan as a proposal and each tool invocation as a controlled transition. The agent might inspect a repository, identify a test command, make a localized change, run the test, and then summarize the result. Each step should be persisted with its inputs, outputs, status, and timestamps.
This structure makes recovery practical. If a job stops after creating a branch but before running tests, the next worker can resume from recorded state instead of reconstructing the entire conversation. It also makes audits possible: teams can answer what the agent did, why it did it, and which evidence it used.
A simple workflow state model is often more valuable than a sophisticated autonomous loop:
- Validate the request and permissions.
- Collect the minimum relevant context.
- Create a proposed plan when the work has meaningful risk or scope.
- Execute one bounded action at a time.
- Verify the expected result with an independent check.
- Complete, retry safely, or escalate with useful evidence.
Independent verification matters. If an agent edits code, its next action should not merely be to declare the change correct. It should run the relevant available checks, inspect their result, and clearly report what was and was not verified.
Context is a dependency, not a prompt attachment
Models can reason only over the information they receive. In production, that information changes: policies are revised, customers update records, repositories evolve, and incident status shifts by the minute. Treat context retrieval as part of the workflow with ownership, freshness expectations, and access controls.
Retrieve narrowly and cite internally which records informed the decision. For example, a support agent may need the current refund policy, order status, and prior conversation—not every document in a company knowledge base. Smaller, relevant context reduces distraction and lowers the chance that sensitive but irrelevant data influences an answer.
Context also needs adversarial thinking. External text, tickets, documents, and web content may contain instructions that conflict with the agent’s role. The system should treat retrieved content as data, never as authority to change its goals, permissions, or safety rules.
Put humans at the right decision points
Human review is not a sign that an agent failed. It is a deliberate control for decisions where the cost of error exceeds the value of automation. The goal is not to insert approval after every click; it is to reserve attention for material judgment.
Useful approval gates include irreversible actions, policy exceptions, unusually large financial impact, security-sensitive changes, and low-confidence classifications. A strong escalation includes the proposed action, supporting evidence, missing information, and a concise question. “Unable to proceed” creates work. “The account shows two charges, but the policy exception requires approval; approve a draft refund of this order?” lets a person decide quickly.
Measure execution quality, not just model fluency
An agent can sound excellent while producing weak operational results. Evaluate the whole system against representative tasks: completion rate, correct routing, time to resolution, unnecessary escalations, failed tool calls, duplicate effects, and the quality of recovery after failure.
Review traces, especially near misses. Did the agent have the necessary context? Did a tool response create ambiguity? Did the workflow permit an unsafe action? These questions usually produce more durable improvements than endlessly rewriting a system prompt.
Version prompts, tool schemas, policies, and evaluation cases together. When behavior changes, the team should be able to identify whether the cause was a model update, a retrieval change, a tool contract change, or a workflow rule.
The durable definition of autonomy
Genuine product execution is not an AI that acts without supervision. It is an AI system that can carry useful work across real boundaries: incomplete information, unreliable services, changing state, permissions, and accountability.
The best agents will often look less theatrical than a free-form chatbot. They will be specific about their authority, careful with side effects, transparent about uncertainty, and easy to interrupt. That restraint is not a limitation. It is the architecture that lets an AI move beyond the draft and earn a place in production work.