Run agents securely

    Give the agent its own workspace

    Unattended work needs boundaries you can enforce. Define what runs automatically, what it can reach, and where it must stop—before the job starts.

    Separate machines. Separate identities.
    1. 01

      Your everyday machine

      Email, password manager, personal browser and administrator accounts stay here.

    2. 02

      The agent workspace

      A disposable VM or dedicated machine, a project copy, and only the tools this job needs.

    3. 03

      Production & shared services

      A separate identity and release path. The worker cannot change its own access policy.

    For broad shell or browser autonomy, start with a VM or dedicated device and a separate network segment. A container shares its host kernel: avoid privileged mode, host mounts and the Docker socket. A folder or Git worktree alone is not a security boundary.

    Restrict both files and network access. Keep personal logins and production secrets out; copy in only the inputs needed. Websites, emails, repositories and tool output can contain prompt injection. Treat their instructions as untrusted data, even when the source looks familiar.

    Authorize the job, limit the reach

    Review the access policy and meaningful outcomes. Routine edits and tests can proceed within that policy without approving every response.

    Example policy · select an action

    Runs automatically

    Read and edit the project copy; run tests inside the isolated workspace. File and network restrictions also apply to scripts and child processes.

    One job, one identity

    Use a dedicated service account with an owner and an expiry. Scope access to the repository, branch, folder or dataset needed. Keep development and production accounts separate; protect human administrator sign-in with MFA or passkeys.

    Credentials on demand

    Prefer a credential broker or workload identity that issues short-lived, limited tokens. In CI, OIDC can replace stored cloud keys when the trust policy binds the correct repository, branch and environment. Keep master keys, browser sessions and SSH agents outside the worker.

    Enforce the scope outside the model

    Tool permissions must be checked by the service executing the action. Limit spend, run time and retries there too. Keep policy changes, bulk deletion and new integrations behind a separate control. Prompts and an AI reviewer cannot replace authorization.

    Keep the entire toolchain patched

    Make vulnerability checks continuous. An urgent advisory should trigger action between scheduled maintenance windows.

    Know what is running

    Track OS, browser, harness, extensions, MCP servers, packages and base images. Subscribe to their official advisories and match CISA’s KEV feed to your inventory. An absent KEV entry does not establish safety.

    Close the exposed gap quickly

    Prioritize active exploitation and internet-facing systems. Apply the vendor’s supported security update or mitigation promptly; isolate affected services if a fix cannot be applied. Assign an owner and a deadline instead of waiting for the next routine cycle.

    Update, restart, verify

    Test routine updates on a spare environment, then roll them out with a recovery plan. Rebuild old worker images, restart affected processes and verify the running version. Pin reviewed dependencies; advance the pin for security fixes. Remove unused plugins.

    Use AI to investigate and defend

    Automate evidence gathering and first-pass triage. Keep the defender’s access separate, and make every response traceable to a concrete event.

    Collect evidence automatically

    Send tool calls, permission denials, sign-ins, network destinations and spending signals to a log store the worker cannot erase. Redact secrets. Alert on unusual uploads, privilege changes and repeated failures.

    Let AI do the first investigation

    Use a separate, read-only defender to group alerts, connect events, match advisories and propose a patch or containment plan. Require links to the original evidence. Measure false alarms and missed incidents with known test cases.

    Bound the response

    A tested playbook can automatically pause one worker or revoke its token. Broad account shutdowns, firewall changes and deletion need a separate decision. Logs and retrieved threat reports may also contain hostile instructions; the defender needs its own isolation and access limits.

    AI can miss attacks and misclassify legitimate activity. Keep endpoint protection, deterministic checks and incident ownership. A second model is another fallible component, not an independent security boundary.

    Practice stopping and recovering

    Before leaving an agent unattended, verify that it cannot read a test secret, reach a blocked destination or exceed its job budget. Use dummy data and an isolated test environment.

    1. 01

      Stop the worker and isolate its network. Revoke issued tokens and connected sessions; stopping a process alone does not invalidate stolen credentials.

    2. 02

      Preserve logs and identify affected files, accounts and destinations. Rotate exposed secrets from a clean machine and follow your organization’s incident process.

    3. 03

      Rebuild from a known-good, patched image; restore verified data. Fix the original access path and run the failing security test before enabling automation again.

    Keep a tested backup and a stop control outside the agent’s account.

    Operating your own model service? Continue in Research →

    Guide checked · Individual sources carry their own dates.

    Report an outdated instruction