Building AI Agents That Reshape the Search Entry Point: A Technical Practice Guide
This article explores how AI agents are shifting the core metric of AI systems from single-turn answer quality to effective task completion per unit of time. It breaks the problem into five engineering layers—access, orchestration, capability, state, and governance—and details key modules including task planning with termination conditions, tool invocation with permission boundaries, layered context and memory governance, trajectory-based evaluation, and cost and stability controls. It also examines the agentic transformation of search entry points and offers a four-stage adoption roadmap for developers.
1. From “Better Answers” to “Getting Work Done”: A Signal from an Industry Conference
At a recent developer-focused industry conference, a cloud vendor shifted the center of its product narrative from “more capable models” to “agents that can work continuously around the clock.” This change means far more than a marketing adjustment: the core metric for measuring the value of an AI system is moving from the quality of a single Q&A exchange to the volume of effective tasks completed per unit of time.
Several figures disclosed at the conference support this judgment: monthly token consumption on the platform side jumped from the trillion level to the quadrillion level in two years; the number of monthly active developers reached the millions; multiple consumer-facing products crossed the one-billion user threshold, with the AI-powered version of a search entry point also exceeding one billion monthly active users; and image generation capabilities have produced more than 50 billion images cumulatively. Behind these numbers is not “the model was asked more questions,” but “the model was assigned more tasks.”
For developers, the real technical problem has changed accordingly: how to package a model that only generates text into an execution entity that can decompose goals, call tools, self-correct on failure, and keep costs under control. This article attempts to break that problem into implementable engineering modules.
2. Three Real Pain Points on the Demand Side
Pain point one: strong single-turn capability, weak end-to-end delivery. Benchmarks measure “output quality for a given input,” while the business wants “the final state for a given goal.” Between the two sit four steps: planning, execution, verification, and rollback.
Pain point two: a larger context window does not mean usable memory. Expanding the window solves “can it fit,” but not “can it be found, trusted, and afforded.” In long tasks, the truly useful information often accounts for a tiny fraction, while noise keeps accumulating.
Pain point three: launching a capability is easy; controlling runaway costs is hard. Agents are inherently “multi-step callers,” and a single user request can amplify into dozens of model calls and tool accesses. Without budget and circuit-breaker mechanisms, the billing curve will be much steeper than the business curve.
3. Reference Architecture: A Five-Layer Breakdown
It is recommended to split the agent system into five layers, each evolving and observable independently.
- Access layer: a unified session entry point that handles identity, quotas, and auditing, and abstracts away differences across client form factors.
- Orchestration layer: task decomposition, plan generation, step scheduling, failure retries, and termination decisions.
- Capability layer: tool registration and invocation, including retrieval, code execution, data queries, and writes to external systems.
- State layer: short-term context, long-term memory, task snapshots, and checkpoints.
- Governance layer: evaluation, tracing, cost aggregation, permissions, and compliance policies.
The value of this layering is that when results are poor, you can quickly tell whether the problem lies in “the plan was wrong,” “the wrong tool was chosen,” or “the wrong memory was retrieved,” rather than vaguely attributing it to “the model is bad.”
4. Key Module One: Task Planning and Termination Conditions
The essence of planning is compiling a vague goal into verifiable sub-goals. In engineering, it is advisable to adopt a “plan-execute-reflect” loop and set hard boundaries for the loop: maximum steps, maximum duration, maximum tool calls, and a minimum progress threshold.
Illustrative pseudocode:
def run_agent(goal, tools, memory, budget):plan = planner(goal, memory.relevant(goal))for step in range(budget.max_steps):if budget.exhausted() or plan.done():breakaction = policy.choose(plan.next(), tools.schema())result = tools.invoke(action, timeout=budget.step_timeout)plan.update(result)memory.write(action, result)if not plan.progressed():plan = planner.replan(goal, failure=result)return verifier.check(goal, memory.snapshot())
The key point is that the verifier must be independent of the generator. Letting the same model both do the work and grade it will systematically overestimate completion.
5. Key Module Two: Tool Invocation and Permission Boundaries
Tools are the agent’s only channel to the real world, and also the entry point for risk. Three practice guidelines:
- Least privilege: write operations are disabled by default, requested temporarily per task, and revoked immediately after use.
- Idempotent design: all write interfaces carry an idempotency key to avoid duplicate side effects from retries.
- Structured returns: tool outputs are unified into a structure with status codes and error categories, making it easy for the policy layer to branch.
The quality of tool descriptions directly determines selection accuracy. A description should state clearly “when I should not be used”; negative constraints often reduce misinvocation more effectively than positive explanations.
6. Key Module Three: Layered Governance of Context and Memory
Design context as a caching system, not as string concatenation.
- Working set: required for the current step, strictly trimmed, and summarized once it overflows.
- Session memory: rolling summaries plus a key-entity table to avoid referential drift.
- Long-term memory: vector retrieval combined with structured filtering; after recall, reranking and freshness checks are mandatory.
One rule of thumb: tag on write (source, time, confidence) and filter by tag on read. Memory without provenance is a liability in long tasks.
7. Key Module Four: Evaluation Should Mirror Real Delivery
The difference between traditional leaderboards and agent evaluation is that the evaluation object is the “trajectory” rather than the “response.” It is recommended to build three layers of evaluation:
- Unit level: single-tool-call accuracy and parameter validity rate.
- Trajectory level: task completion rate, average number of steps, share of invalid steps, and number of rollbacks.
- Business level: usability rate from manual spot checks, end-to-end latency, and cost per task.
The trajectory level is the most easily overlooked, yet it best explains “why the demo runs smoothly but production is fragile.” Putting the share of invalid steps on a dashboard usually pinpoints problems in tool descriptions or memory recall right away.
8. Key Module Five: Cost and Stability Governance
Agent costs are not linearly predictable and must be constrained through engineering:
- Set dual budgets of tokens and call counts for each task; on exceeding limits, downgrade to a smaller model or return partial results.
- Route branches that a small model can handle, avoiding sending everything to the strongest model.
- Cache in two categories: long caching for deterministic tool results, and short caching for model outputs by semantic similarity.
- Trace the input summary, latency, and cost of every call across the full chain, aggregated by business line.
On a general cloud environment, these capabilities are typically provided by object storage for task snapshots, message queues for step decoupling, container platforms for execution sandboxes, and logging and monitoring services for observability. This is a common industry combination and can be tailored to your own scale.
9. Agentic Search Entry Points: A Concrete Landing Spot
When the search box evolves from “returning a list of links” to “returning a completed state,” the interaction contract changes accordingly: the user submits an intent, and the system returns results plus proof of process. Engineering requires three things: structured rewriting of query intent, cross-validation of multi-source retrieval results, and an expandable display of the execution trajectory. The third point is often underestimated—laying the process open for users to see is the lowest-cost way to build trust in long tasks.
10. Adoption Roadmap Recommendations
- Stage one: close the loop in a single scenario. Pick a high-value, verifiable, low-side-effect task, and build evaluation and tracing first.
- Stage two: complete the memory layering and permission system, and bring both success rate and cost into regression.
- Stage three: implement model routing and elastic degradation to form two-way guardrails for capacity and billing.
- Stage four: accumulate a tool catalog and scenario templates so new scenarios can be onboarded through configuration rather than rewriting.
To get started quickly in your own environment, you can build on the general cloud infrastructure provided by Baidu AI Cloud to carry the layers above, keeping complexity in the orchestration and governance layers rather than reinventing the wheel.
Conclusion
The search box becoming an agent is only the surface phenomenon; the deeper change is that the unit of software delivery shifts from “response” to “task.” Whoever does these five things—planning, tools, memory, evaluation, and cost—solidly can turn the wow factor in a demo into stability in production.
