A chatbot reads text and generates responses. An agent can also execute code, modify files, call APIs with real credentials, browse websites, and work on tasks that take minutes or even hours to complete.
These capabilities introduce infrastructure and security challenges beyond those of a typical chat application. Model-generated code needs an isolated environment where it cannot damage the host system. Long-running tasks need to recover from worker crashes and restarts. Agents that send emails or modify data on a user's behalf need clear permissions and approval controls. They also process untrusted content, which attackers can use to influence their actions.
In this chapter, we'll cover the infrastructure needed to run agents safely and reliably in production, including sandboxing, durable execution, approval gates, and access control.