Deploying Agents Best Practices
Ten practices for choosing a host, packaging the runtime, and hardening secrets so agent workloads stay within time, budget, and blast-radius limits.
Search across all documentation pages
Ten practices for choosing a host, packaging the runtime, and hardening secrets so agent workloads stay within time, budget, and blast-radius limits.
Use this list when you first ship an agent or when timeouts, leaks, or surprise bills force a re-platform.
/healthz without model calls; process managers restart on failure (Long-Running Agents on a VPS: Process Management and Restarts).| Stage | Habits | Exit criterion |
|---|---|---|
| Design | 1-3 | Target chosen; duration budget written; stop conditions defined |
| Package | 4-6 | Immutable artifact; health; external state |
| Harden | 7-8 | Key topology + idempotent tools |
| Operate | 9-10 | Metrics, drills, rollback proven |
.env.repo/
Dockerfile # multi-stage, non-root
.dockerignore # excludes .env
.env.example # names only
src/agent_app.py # bounds + deadlines
deploy/
systemd/agent.service # or k8s/lambda/vercel config
README.md # env matrix + rollback# pattern: fail closed + bound
import os
if os.getenv("APP_ENV") == "production":
assert os.getenv("OPENROUTER_API_KEY"), "missing key"
MAX_TURNS = int(os.getenv("AGENT_MAX_TURNS", "8"))
# loop with turn < MAX_TURNS and deadline.remain() > marginWorkload-matched placement (1), run bounds (3), and per-environment secrets (7). Everything else amplifies those.
Yes on scale and multi-tenancy, not on secret hygiene or restart discipline. Personal bots still need process managers and key caps.
No. Production means observability, rollback, secrets, and SLOs - on a VPS, PaaS, or cluster.
After timeout incidents, 10× traffic, new heavy tools (browser/GPU), or cost cliffs. At least when annual planning resets budgets.
As a deploy gate: latency and success thresholds must pass before artifacts promote (Running Eval Suites as a CI Gate Before Deploy).
Only if cold starts and timeouts do not destroy conversion or burn retries. Model fully loaded cost per successful task.
Containers are the best default portable unit, but pure functions are fine for short stateless turns. Avoid religious packaging.
This page is runtime placement and ops. Pair with Security Checklist Before Shipping an Agent to Production for tool and sandbox controls.
Related: Choosing a Deployment Target for an Agent Workload
Related: Deploying Agents Basics
Related: Containerizing an Agent with Docker
Related: Deploying an Agent to Vercel or AWS Lambda Serverless Functions
Related: Long-Running Agents on a VPS: Process Management and Restarts
Related: Cold Starts and Long-Running Agent Loops: A Serverless Mismatch
Related: Environment and Secrets Management Across Deployment Targets
Related: CI/CD and Agent Lifecycle Basics
Stack versions: Pins from the category manifest (verify at build): OpenRouter (~315+ models, July 2026 pricing/fees); LangGraph 1.0+; CrewAI 1.14+; Microsoft Agent Framework 1.0; Vercel AI SDK 6; Pydantic AI (latest); LlamaIndex (latest); OpenAI Agents SDK (latest + MCP); MCP (Linux Foundation governance); A2A (HTTP+SSE+JSON-RPC 2.0); Solana
@solana/web3.js+@solana/spl-token.
Reviewed by Chris St. John·Last updated Jul 16, 2026