How I isolated credentials in a multi-tenant agent platform with per-chat MCP subprocesses
International_Gap713 · reddit · 2026-11-24
An engineer building a no-code platform where customers create their own AI agents (support bots over docs, sales agents reading CRMs) shares what worked — concluding that agent quality is mostly a systems problem, not a prompt problem.
1. Credentials belong to the chat, not the agent
- Attaching integrations to agents means every chat holds every credential; one prompt injection could reach another user's data
- Fix: agents are created with zero credentials; each chat picks its allowed integrations; every enabled tool runs as an isolated MCP server subprocess holding only a connection ID and looking up its own OAuth token
- Chat A can use Gmail while chat B uses Postgres, with neither process seeing the other's secrets
2. Show the model fewer tools: with 50 tools, selection degraded and descriptions ate context; a cheap routing step scores tools against each user message and exposes only the top few
3. Hybrid retrieval: pure embeddings missed exact strings (error codes, SKUs); combining OpenAI embeddings with BM25, reranking, then compressing chunks to relevant sentences worked — the reranker made the biggest difference
4. Validate everything before execution: strict Pydantic schemas for all tool calls and answers, LangGraph state machines for multi-step flows
More from coding & agent
- Claude Code /steward bug: fake PR watch locks gh commands for whole session — danielmackay · 2026-11-24
- Blogger uses Codex to scan local app usage and auto-generate a year-in-review Mac software poster — vista8 · 2026-11-24
- patch Multiplayer: one prompt adds rooms, invites and quick match to your game — Scobleizer · 2026-11-24
- What hidden costs has AI adoption added to your engineering org? — GroundbreakingFun336 · 2026-11-24
- Anchor runs browser agents on real cloud Mac Minis with genuine Chrome, not Linux spoofing — ghumare64 · 2026-11-24
- Atom v1: open-source pixel pet with 19 states lands for Antigravity — cereal_commentor · 2026-11-24