AI Agent Security Checklist: What to Do Before Your First Run
This article presents eight security controls for running AI agents for the first time, ordered from foundational to detailed. It explains why isolation, least privilege, and a reduced network exposure surface determine the scale of risk, then covers extension source review, dry-run execution, full auditing, data and key governance, and a repeatable pre-launch checklist. The goal is to turn "trust" into verifiable boundaries so the worst case stays within a disposable, rollback-capable, and explainable environment.
AI Agent Security Checklist: What to Do Before Your First Run
In recent years, AI agents—represented by “intelligent coding tools” and “automated task agents”—have expanded their capabilities rapidly. They can read and write files, invoke command-line tools, drive browsers, operate office software, and translate a single natural-language instruction directly into a series of real actions. The efficiency gains are real, and so are the risks. Errors in traditional software usually show up as “the result is wrong,” whereas an agent’s errors may show up as “an action that should never have happened”—for example, deleting a directory by mistake, writing internal material into an external request, or being hijacked by hidden instructions embedded in external content. So what you actually need to establish on the first run is not “trust,” but verifiable boundaries.
Below are eight security controls, ordered from foundational to detailed. The first three determine the magnitude of the risk; the last five determine whether the risk is controllable and traceable.
1. Isolation First: Do Not Run on Your Primary Machine
This is the only measure that reduces potential loss by an order of magnitude. The test is simple: if the machine holds company secrets, customer data, scanned identity documents, payment information, or work products that cannot be rebuilt, it is not suitable as the environment for an agent’s first run.
The recommended approach is to use a virtual machine or a separate container as a “disposable workspace,” following three constraints:
- Set disk capacity and mount scope explicitly, mounting only the directories the task requires;
- Tighten network policy by default, allowing only the egress the task requires;
- Roll back the snapshot or destroy the environment when the task ends, rather than reusing it long term.
An illustrative resource and mount constraint (pseudo-config, expressing intent only):
workspace:type: vm # or containerdisk_quota: 20Gi # explicit cap, avoid filling up the hostmounts:- host: ./task_inputguest: /work/inmode: ro # input is read-only- host: ./task_outputguest: /work/outmode: rwsnapshot_before_run: truedestroy_after_run: true
To emphasize: isolation is not “an extra layer of insurance”; it compresses the blast radius from “an entire personal computer or office endpoint” down to “a single disposable environment.”
2. Least Privilege: Grant Only What the Current Task Needs
Never give an agent administrator or superuser privileges. Least privilege must constrain three dimensions at once: files, applications, and credentials.
- Files: create a dedicated working directory and expose only that directory; desktop, documents, downloads, and local data directories of instant messaging apps must all be invisible.
- Applications: do not expose the ability to invoke sensitive apps such as messaging, browsers, payments, or email; keep only the components the current task requires.
- Credentials: never store keys, passwords, or tokens in plaintext in environment variables, config files, or scripts; inject them through external credential management or short-lived tokens that expire when the task ends.
A practical rule to apply: audit the agent’s identity as if it were an “external partner account”—it can only see the one meeting room specifically set aside for this collaboration.
# Run as a low-privilege dedicated account, with no write access outside the working directorysudo useradd -m -s /bin/bash agent_sandboxsudo chown -R agent_sandbox:agent_sandbox /srv/agent_worksudo -u agent_sandbox -H bash -lc 'cd /srv/agent_work && ./run_task.sh'
3. Reduce Network Exposure: Never Put Management Ports on the Public Internet
Mapping a management port directly to the public internet for convenient remote access is equivalent to leaving an unlocked door: once such an interface is scanned, what an attacker faces is “an entry point that executes instructions,” not just a page.
- Local runs: listen only on the loopback address (such as 127.0.0.1), and do not open LAN access unless necessary.
- Remote access is required: layer on restrictions via a virtual private network, strong authentication, and a source address allowlist, and enable transport encryption.
- Explicitly prohibited: using “one-click public deployment scripts” of unknown origin, which may contain backdoors, weak-password initialization, or additional outbound connections.
bind: 127.0.0.1auth:mode: strong # strong authentication, no default passwordsmfa: truenetwork:allow_lan: falseingress_allowlist: [] # explicitly list trusted sources for remote scenarios
4. Review Extension and Plugin Sources: Do Not Install Anything of Unknown Origin
Third-party extensions are a hotspot for supply chain poisoning. The harm is greater in agent scenarios, because a malicious extension often does not “steal data” but “issues new instructions.”
- Install only from trusted channels that provide signature verification;
- Review the code and declared permission scope before installation; if you do not understand it, do not install it;
- Reject outright any extension whose permission declarations clearly do not match its actual behavior;
- Disable automatic extension updates, and manually review changes (diffs and permission changes) before each upgrade.
It is advisable to maintain an “extension allowlist ledger” recording name, version, source, checksum, authorized scope, and reviewer, with a trace left for every change.
5. Simulate Before Executing: Replace Direct Landing with a Dry Run
For irreversible actions (deletion, overwriting, batch renaming, external sending, code commits, releases), establish a three-stage “preview—confirm—execute” flow. The preview stage only outputs the actions that will occur and the scope of impact; execution happens only after human confirmation.
plan : list target paths, match counts, expected impact (read-only)review: human confirmation, narrow the scope if necessaryapply : execute, and write to the audit log
Also set guardrails for high-risk actions: path allowlists, batch operation thresholds, secondary confirmation, and a cap on the “maximum number of files changed in a single task.” Once a threshold is exceeded, abort automatically rather than continue.
6. Full Auditing and Fast Damage Control: Every Step Must Be Traceable
Enable complete operation logs that record instructions, system calls, file changes, network requests, and execution results, and ensure the logs are written to a location the agent cannot modify. The value of logs lies not in “checking after an incident,” but in three capabilities: locating the scope of impact, determining whether data has leaked, and reproducing the conditions of a problem.
The minimum recommended audit fields include: timestamp, task ID, action type, target object, parameter summary, return status, and the triggering source content. Combined with monitoring and alerting, set threshold notifications for abnormal outbound connections, abnormal privilege escalation, and large-volume write operations in a short period.
7. Data and Key Governance: Reduce “What Can Be Leaked” at the Source
Even with privileges constrained, assume the workspace may be read. Therefore sensitive data should not enter the workspace: prefer desensitized samples, synthetic data, and the minimum necessary fields. Use short-lived tokens for keys, authorize them per task scope, and revoke them immediately after use; apply an egress allowlist for external requests to avoid arbitrary address reachability.
When artifacts need to be persisted, you can use general-purpose capabilities such as object storage to save results, forming a closed loop with logging services and monitoring alerts; access credentials likewise follow the short-lived, minimum-scope principle.
8. Turn the Checklist into a Baseline: A Repeatable Check Table
Confirm each item before first use; if any item fails, do not start:
- The runtime environment is a disposable, isolated environment, and a snapshot has been created;
- A low-privilege dedicated identity is used, with no write access outside the working directory;
- Sensitive directories and sensitive applications are inaccessible;
- There are no plaintext keys; credentials are short-lived tokens;
- The listening address is loopback, and public exposure is zero;
- Extension sources are verifiable, code has been reviewed, and automatic updates are disabled;
- The preview flow and high-risk action guardrails are enabled;
- Audit logs, anomaly alerts, and the damage-control path have been verified as usable.
Conclusion: agent security is not a single switch, but a set of engineering constraints. Only by hardening “isolation, least privilege, zero exposure, controlled sources, simulate first, and auditability” into default configurations can you gain efficiency benefits while keeping the worst case within a range that is disposable, rollback-capable, and explainable.
