# Architecture Design and Implementation of an Enterprise-Grade General-Purpose Work Agent

    How should enterprises architect a general-purpose work agent that moves beyond simple Q&A assistants? This article breaks down the core capability boundaries, a five-layer reference architecture, four key engineering mechanisms (sub-agents with independent identities, stateful memory, event-driven triggers, sandboxed code execution), governance essentials, and a pragmatic rollout roadmap—along with the common pitfalls to avoid.

    1. The Starting Problem: From “Responding to Commands” to “Achieving Goals”

    Over the past two years, most enterprise LLM deployments have been assistant-style tools built on an inherently “question-in, answer-out” interaction model: the user issues an explicit instruction, and the model performs a single preset action within one application. These tools deliver clear efficiency gains for writing refinement, summarization, and single-turn Q&A—but they break down quickly once a task spans multiple systems, requires multi-step reasoning, or must wait for external conditions, because the user is forced to act as both “task decomposer” and “workflow porter.”

    The general-purpose work agent is designed to close exactly this gap. Its goal is not to make a single answer better, but to autonomously complete planning, execution, verification, and delivery once it receives a goal description. This brings three fundamental shifts:

    • The unit of interaction changes from “command” to “goal”: The user says “compile last quarter’s sales data across three regions into a review-ready document,” instead of clicking through ten buttons in sequence.
    • The unit of execution changes from “single call” to “long-running task”: Tasks may run for hours or even days, pausing for approvals or for data to become ready.
    • The boundary of accountability changes from “advice” to “deliverables”: The agent must produce results that can flow directly into business processes, which means outputs must be auditable, reversible, and attributable.

    Understanding these three shifts is the prerequisite for deciding whether an enterprise truly needs a general-purpose work agent. If a scenario is high-frequency, short-chain, and highly deterministic, dedicated automation pipelines are often more economical.

    2. Capability Boundaries: Six Traits of a General-Purpose Work Agent

    Drawing on widely accepted definitions, a general-purpose work agent ready for enterprise production typically exhibits the following traits:

    1. Unified entry point with multi-task coverage: Q&A and retrieval, knowledge processing, content creation, code writing and execution converge in the same session and context, so users never switch tools or re-explain background.
    2. Tool and data access: It connects to internal enterprise systems—email, calendars, documents, spreadsheets, presentations, instant messaging, ticketing, data warehouses—turning “knowing” into “doing.”
    3. Autonomous goal decomposition: It breaks vague goals into executable subtasks and dynamically adjusts the plan based on intermediate results during execution.
    4. Long-running execution with sub-agent collaboration: A main agent handles planning and synthesis while multiple sub-agents work on independent subtasks in parallel, forming a small-team-like collaboration structure.
    5. Dual trigger mechanisms: It supports both scheduled tasks (periodic checks, daily report generation) and event triggers (an inbound email, a code merge, or a monitoring alert automatically kicking off a workflow).
    6. Cross-device consistency and open access: Web, mobile, and desktop clients plus third-party collaboration channels share the same context and memory, while open APIs let external business systems invoke the agent.

    3. Reference Architecture: A Five-Layer Breakdown

    Engineering these capabilities yields a five-layer structure.

    Access layer: A unified session gateway handling multi-device protocol adaptation, identity passthrough, and request throttling. The key design decision is decoupling “channel” from “session state”—channels handle rendering and transport only, while the orchestration layer owns the state, so switching devices never loses context.

    Orchestration layer: The agent runtime, responsible for intent understanding, task planning, tool selection, loop control, and termination decisions. This is the heart of the system. Explicitly design maximum step counts, timeouts, budget caps, and human intervention points to prevent runaway loops from wasting resources.

    Capability layer: A dual resource pool of models and tools. On the model side, support task-based routing—structured extraction can use smaller models to control cost, while complex reasoning and code generation switch to more capable models. On the tool side, register tools with standardized descriptions (name, purpose, inputs, outputs, permission requirements) so the orchestration layer can discover and select them.

    Data and tool layer: Enterprise system connectors, hybrid vector and keyword retrieval, and a permission-filtering gateway. The core principle: permission filtering must happen before retrieval, not by pruning results after recall—otherwise sensitive data has already entered the context.

    Governance layer: Unified identity, least privilege, end-to-end auditing, data classification, cost metering, and quality evaluation. This layer determines whether the product can pass enterprise security review.

    4. Deep Design of Four Key Mechanisms

    4.1 Sub-Agents with Independent Identities

    The technical essence of the “colleague agent” model is not making agents look human, but giving each agent an independent identity and independent permissions. A main agent should never inherit the user’s full permissions by default, or you create a privilege-escalation vulnerability. The recommended approach: issue an independent service identity for each agent type, grant permissions minimally per task template, and attach source markers when data crosses agents, enabling audit and traceability.

    1. agent:
    2. id: research-collector
    3. identity: svc-agent-research # Independent service identity
    4. scopes: [docs.read, drive.read] # Least privilege
    5. budget: { steps: 40, tokens: 200k, wall_clock: 30m }
    6. escalation: human_approval # Escalate to human when exceeding scope
    7. children: [doc-summarizer, chart-renderer]

    4.2 Memory and Context Consistency

    The prerequisite for cloud-side execution and cross-device consistency is externalized state. Session history, task artifacts, and long-term preferences should live in server-side structured storage; clients hold only a session identifier. Distinguish three types of memory: short-term working memory (current task steps), task memory (intermediate artifacts and tools used), and long-term memory (user preferences and business terminology). Long-term memory must support explicit viewing and deletion to meet compliance requirements.

    4.3 Trigger Mechanisms: Scheduled and Event-Driven

    1. # Pseudocode: event-driven long-running task
    2. @on_event("mail.received", match={"subject_regex": r"^Contract Review"})
    3. def contract_review(evt):
    4. plan = planner.decompose(goal=evt.summary, context=ctx.load(evt.thread_id))
    5. run = runtime.execute(plan, agent="contract-agent",
    6. require_approval=["external_send"])
    7. audit.log(run) # Full audit trail
    8. notify(evt.sender, run.summary)

    For event triggers, pay special attention to idempotency: repeated delivery of the same event must not trigger duplicate outbound actions. Using a unique event ID as a deduplication key is the lowest-cost safeguard.

    4.4 Security Isolation for Code Execution

    An agent’s ability to “write and run code” is both the most valuable and the most dangerous capability. In production, code must execute in a disposable sandbox with no outbound network access (or a strict allowlist), an isolated filesystem, resource quotas, and destruction after execution. Code involving write operations must always go through approval and reversible branches.

    5. Governance: The Must-Answer Questions for Enterprise Review

    • Identity and permissions: Agent identities are folded into the unified identity system; permissions can be granted, revoked, and expired.
    • Audit and traceability: Log the goal, plan, every tool call, parameters, results, and durations; support task-level replay.
    • Data boundaries: Define which data may enter model context; mask or localize sensitive fields.
    • Cost and quotas: Meter by department, project, and agent; set budget circuit breakers.
    • Quality evaluation: Build offline evaluation sets plus online sampling, tracking task completion rate, human takeover rate, and average time saved.
    • Human-in-the-loop: High-risk actions (external sends, financial operations, production changes) require human confirmation by default.

    For infrastructure selection, enterprises typically rely on general-purpose cloud platform capabilities to support these needs—for example, object storage for artifacts, message queues for events, container platforms for sandboxes, and logging services plus monitoring and alerting for observability. Baidu AI Cloud likewise offers these general-purpose cloud product categories, which can serve as the foundational components for building this kind of agent runtime.

    6. Rollout Roadmap and Common Pitfalls

    A four-phase approach is recommended: start with read-only scenarios (retrieval, summarization, draft reports) to validate accuracy and the permission model; then open up internal write operations (updating documents, creating tickets); next introduce scheduled and event triggers to form automated loops; and only finally open external actions, paired with approval workflows.

    Three common pitfalls deserve special caution: first, treating demo results as production metrics while ignoring long-tail failure rates; second, over-granting permissions just to “get things running,” planting privilege-escalation risks; third, lacking termination conditions and budget controls, allowing long-running tasks to spiral out of control. The value of a general-purpose work agent lies not in replacing people, but in handing cross-system, multi-step, standardizable workflows to an auditable automation executor—freeing people to focus on defining goals and judging outcomes.