Practical Guide to General-Purpose AI Agents: Architecture and Evaluation
This article breaks down what makes an AI agent "general-purpose," the five capability layers a usable agent requires, a minimal runnable control loop, a four-layer evaluation framework, and a governance checklist for deployment. It is written for engineers and technical leaders who need to assess agent reliability beyond demo performance and build an engineering system matched to their own task distribution.
1. Aligning the Concept: What “General-Purpose” Actually Means
The term “agent” has been used heavily across the industry over the past two years, with widely varying meanings. To keep the discussion focused, here is a commonly accepted definition: a general-purpose AI agent is a software system that uses a general-purpose large language model as its reasoning core, and that can plan autonomously, call tools, retain state in memory, and verify results, so it can execute open-ended tasks over multiple steps and deliver usable output.
It is distinct from three adjacent forms:
- Versus single-turn question-answering models: the latter is a one-shot mapping from input to output, while an agent is a search process from goal to trajectory, with multiple rounds of decisions in between.
- Versus traditional workflow orchestration: workflow nodes and branches are fixed in advance by humans, while an agent’s next action is decided by the model at runtime, making the flow dynamic.
- Versus coding assistants: coding assistants usually focus on code completion and local generation, while agents emphasize end-to-end task closure across files and systems.
“General-purpose” refers to the openness of the task domain, not to unlimited capability. Understanding this is the premise for all evaluation that follows: an agent’s reliability does not depend on how impressive it looks on a demo task, but on how it fails outside its task distribution.
2. Capability Breakdown: Five Layers a Usable Agent Must Have
Splitting an agent into five layers makes it easier to locate which layer a problem comes from.
- Reasoning and planning layer. Responsible for decomposing a vague goal into subtasks and replanning when execution is blocked. A common flaw is “over-detailed planning,” which passes uncertainty downstream as if it were certainty, causing later steps to drift collectively.
- Tool and interface layer. The collection of capabilities such as file read/write, command execution, retrieval, network access, and database queries. The quality of tool descriptions often affects success rates more than the model itself does.
- Memory and context layer. Distinguishes short-term session state from long-term knowledge, and involves context compression, summary retention, and retrieval backfill. Long-context capability is only a necessary condition; the strategy for selecting information is what matters.
- Execution and sandbox layer. Provides an isolated environment, resource quotas, and rollback mechanisms. This is the dividing line between an agent that “can think” and one that “dares to act.”
- Verification and delivery layer. Automatically validates outputs (compilation, testing, format checks, assertions) and feeds failures back to the planning layer to close the loop.
There is a useful rule of thumb in engineering: most complaints that “the agent performs poorly” trace back to layers 2 and 5, not to insufficient model reasoning capability.
3. Reference Architecture and a Minimal Runnable Loop
A deployable agent system typically has a control plane and an execution plane. The control plane handles decisions and scheduling; the execution plane handles isolated runs. Below is a loop sketch with specific products stripped out, expressing only the control-flow idea:
# Pseudocode: minimal skeleton of the agent main loopdef run_agent(goal, tools, sandbox, verifier, max_steps=20):state = Context(goal=goal, history=[])for step in range(max_steps):plan = model.decide(state, tool_schema=tools.schema())if plan.type == "final":return verifier.check(plan.payload, sandbox)result = sandbox.invoke(plan.tool, plan.args) # isolated executionstate.append(plan, result)state = context.compress(state) # summary + retrieval backfillif verifier.failed(result):state.note_failure(result.error) # feed the failure signal backreturn Status.incomplete(state.summary())
Three design points are worth emphasizing. First, the step limit and budget limit must be set explicitly; otherwise the agent will keep consuming resources on a wrong path. Second, failure signals should be fed back in a structured form, rather than stitched into natural language and left for the model to “figure out on its own.” Third, context compression must preserve three kinds of information: the goal, the constraints, and the unresolved problems. Everything else can be trimmed aggressively.
In deployment scenarios that require elasticity and isolation, a common approach is to place the execution plane on a container platform or a function-computing service, store intermediate artifacts in object storage, decouple tasks with a message queue, and handle observability with logging and monitoring/alerting services. Baidu AI Cloud offers corresponding capabilities in these general cloud product categories, and you can select and combine them according to your own architecture.
4. Evaluation Methods: Judging an Agent Without Relying on Gut Feeling
Evaluating an agent cannot rely on the final answer alone. Four layers of metrics are recommended:
- Task success rate: the end-to-end completion ratio on a fixed task set, distinguishing “fully successful” from “usable after manual tuning.”
- Trajectory quality: number of steps, repeated-call rate, and share of invalid tool calls. Redundant trajectories often expose problems earlier than failures do.
- Cost efficiency: average reasoning consumption and execution time per task, which is only meaningful when compared against a human baseline.
- Safety and compliance rate: interception rate of unauthorized operations, interception rate of sensitive-information leakage, and number of dangerous commands triggered.
For building the task set, a “three-tier distribution” is recommended: common scenarios account for 60%, boundary scenarios for 30%, and adversarial samples clearly beyond the capability domain for 10%. Only with the last tier included can you test whether the agent’s failure posture is controllable.
5. Deployment Risks and a Governance Checklist
- Least privilege: default to read-only; write operations and external side effects require explicit authorization, and high-risk actions introduce a human confirmation step.
- Sandbox and rollback: all execution happens in an isolated environment, artifacts are versioned, and one-click rollback is supported.
- Prompt and tool injection protection: treat content from files, web pages, and command output as untrusted data, strictly separated from the instruction channel.
- Full-chain observability: record decision rationale, tool inputs and outputs, and failure reasons to form a replayable trajectory.
- Cost guardrails: set dual quotas per task and per user, with automatic circuit breaking when usage amplifies abnormally.
- Human-AI collaboration positioning: position the agent as an “executor + draft generator,” keeping human review for key decisions and external delivery.
6. Conclusion
Evaluating general-purpose AI agents is not about finding the “strongest model,” but about building an engineering system matched to your own task distribution: clear tool contracts, a reliable verification loop, strict permission boundaries, and a quantifiable evaluation set. Get these four things solid, and the agent’s benefits become stable and predictable; otherwise, even the strongest reasoning capability will only amplify uncertainty.
