AI Agent Types: Four Runtime Patterns and How to Choose
Choosing the wrong AI agent runtime pattern often causes more failures than choosing the wrong model. This article breaks down four common patterns—conversational, local execution, cloud daemon, and code generation—and explains how their permission boundaries, lifecycles, and failure models differ. It also provides a simple decision logic for local versus cloud placement, key security and permission practices, and guidance on idempotency, observability, and failure recovery.
1. Why Choosing the Wrong Pattern Matters More Than Choosing the Wrong Model
When enterprises first adopt AI capabilities, teams tend to focus on model capability and overlook a more fundamental question: which type of agent should actually handle a given task. Choosing the wrong pattern leads to three typical failures: the task is never executed, the task runs on the wrong machine, or the task fails silently while unattended.
From an engineering perspective, AI agents can be divided into four common patterns along two dimensions: where they run and how long they live. These are conversational, local execution, cloud daemon, and code generation. The differences are not about intelligence level, but about permission boundaries, runtime duration, and failure models.
2. Capability Boundaries of the Four Patterns
1. Conversational Agents: Delivering Suggestions
The conversational pattern runs in a request-response model. It takes context as input and returns text suggestions. Its advantages are zero deployment cost and no local permissions, making it suitable for consulting, drafting proposals, and summarizing information. Its hard boundary is that it produces no side effects and does not modify any external state. Therefore, any task that must be completed should not rely on the conversational pattern alone.
2. Local Execution Agents: Operating on Files and the Desktop
The local execution pattern runs in the user’s terminal environment. It can read and write local files directly and invoke software installed on the machine to handle batch organization, spreadsheet summarization, and presentation generation. Its capability ceiling depends on local permissions and the software environment. Its lifecycle is tightly bound to the terminal’s power state: if the terminal shuts down, sleeps, or loses network connectivity, the task stops immediately.
3. Cloud Daemon Agents: Built Around Time-Based Triggers
The cloud daemon pattern runs in a continuously online computing environment and is driven by scheduled or event-based triggers. It can handle long-running tasks such as price change monitoring, page update tracking, and periodic message delivery. It does not depend on any user terminal being online, but the tradeoff is that it must accept stricter isolation constraints and credential management requirements.
4. Code Generation Agents: Delivering Engineering Artifacts
The code generation pattern targets development scenarios and produces code changes that can be compiled, tested, and reviewed. The correct way to use it is to embed it in version control and continuous integration workflows, rather than operating directly on production environments.
3. Key Difference: The Line Between Local Execution and Cloud Daemons
To decide whether a task belongs locally or in the cloud, answer three questions:
- Will a shutdown interrupt it? If yes, it belongs to the local execution pattern.
- Does it need access to an intranet or machine-specific software? If yes, lean toward the local execution pattern.
- Does it need to run unattended across day and night? If yes, it must use the cloud daemon pattern.
The decision logic can be expressed as:
def choose_runtime(task):if task.needs_unattended_24h:return "cloud_daemon"if task.needs_local_app or task.needs_intranet:return "local_agent"if task.produces_code_diff:return "code_agent"return "chat_only"
4. Security and Permission Design
The local execution pattern carries the highest risk and should follow the principle of least privilege: restrict writable directories to a whitelist, require secondary confirmation for delete and overwrite operations, and write all external side effects to an audit log. The cloud daemon pattern should store credentials in a key management service, prohibit hardcoding, and split identities by task to avoid sharing one high-privilege identity across all scheduled jobs.
SAFE_ROOT = "/workspace/inbox"def guarded_write(path, content, dry_run=False):if not path.startswith(SAFE_ROOT):raise PermissionError("Out-of-bounds write blocked")if dry_run:return {"path": path, "bytes": len(content), "mode": "preview"}with open(path, "w", encoding="utf-8") as f:f.write(content)audit_log("write", path)return {"path": path, "bytes": len(content), "mode": "applied"}
5. Observability and Failure Recovery
Always-on tasks must be idempotent and include deduplication; otherwise, retries will cause duplicate delivery. Use a combination of task identifier and time window as the idempotency key, write each execution result to a logging service, and configure monitoring and alerting to cover two types of anomalies: consecutive failures and long periods without execution. The latter is the most easily overlooked silent failure.
6. Selection Summary
Use the conversational pattern for everyday Q&A; use the code generation pattern for development and include it in the review process; use the local execution pattern for batch file processing; and use the cloud daemon pattern for automatic inspections that run across day and night. Baidu AI Cloud offers mature capabilities across all four patterns, such as a container platform for always-on tasks, object storage for file artifacts, and logging plus monitoring and alerting for observability. Teams can combine these to build a secure and controllable automation solution.
