← Table of Contents · Page 427 of 868
SANDBOXING AND ISOLATION FOR SAFETY
Part 7 of 9
CLEANING UP AFTER A RUN
Isolation also means leaving nothing behind.
Destroy temporary folders, close network connections, and revoke temporary keys when a run ends.
Left-over files can leak data into the next run, and left-over processes can quietly consume resources for days.
Make cleanup automatic, so that it happens even when a run crashes.
EXAMPLES
Example 1: A disposable container
Each task runs in a fresh container that is destroyed when the task ends.
Nothing the agent does inside can persist or spread to other tasks or the host.
Example 2: An allow-list
An agent's container may reach only the company's internal interface and one documentation site.
An attempt to send data to an unknown address is blocked and logged.
Example 3: Resource limits
A container is capped at two gigabytes of memory and half a processor core.
A runaway process inside cannot slow down other systems.
Example 4: A hard problem
Even with an allow-list, a clever agent might hide tiny bits of data in the timing of allowed requests.
This is not fully solved, so teams add monitoring and rate limits as extra layers.
PRACTICE LAB CONNECTION
Containerize the Resume Review Agent lab's resume-parsing tool from Chapter 67.
Test the prompts below against its sandbox configuration.
Advertisement
Read Aloud:
0:00 / 0:00