My AI Agents Share a Server. Here’s How I Keep Them Out of Each Other’s Way
说明与用途
多个 AI 代理在同一台服务器上因共享凭据而冲突。为每个代理创建独立的 tenant 和唯一的 API 密钥,实现隔离、无停机的密钥轮换,并可单独禁用代理而不影响其他代理。
问题
Multiple AI agents sharing a single server caused deployment conflicts and lack of isolation, making it hard to stop or manage individual agents without affecting others.
结果
Agents operate in isolated tenant spaces, preventing cross‑agent interference. Key rotation is seamless, and misbehaving agents can be stopped instantly without affecting others.
工作流
- Create a tenant per agent using the bootstrap token via POST /v1/tenants/register
- Store the returned tenant_id and first API key for admin use
- Create a second, agent‑specific API key with an optional expiry via POST /v1/auth/keys
- Configure the agent to use its dedicated key
- Rotate keys by creating a new key, letting the agent use it, then revoking the old key via DELETE /v1/auth/keys/{id}
- To stop an agent, revoke its key or suspend the tenant via DELETE /v1/tenant and reactivate with the admin token if needed
证据
Creating a tenant is one request with the bootstrap token in a header: curl -s -X POST "$AH_URL/v1/tenants/register" -H "X-Bootstrap-Token: $AH_BOOTSTRAP_TOKEN" -H "Content-Type: application/json" -d '{"name":"blog-agent", "email":"[email protected]"}' # {"tenant_id":"3f9a...","api_key":"8c41....d07e..."}
- 记录日期: 2026-10-23T15:11:32.561Z