Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

Infrastructure for Agents

Free · sign in to start and track progress

1 · Compute and execution

  • 1Where agents run
  • 2Sandboxes for agent code
  • 3Durable execution engines
  • 4Queues, schedules and background jobs

2 · State, access and delivery

  • 5State, sessions and checkpoints
  • 6Secrets, identity and tenant isolation

    Exercise answers

    • Answer: Row-level security that fails closed
    • Answer: A per-firm credential proxy
  • 7AI gateways
  • 8Environments and delivery for agents
CapstoneA production platform slice for one agentReference implementation

Module 2 · State, access and delivery · Lesson 6

Secrets, identity and tenant isolation

A platform serving several customer organisations must keep each one's cases, documents, credentials, model traffic and spend apart at every layer. Tenancy models, short-lived credentials with OIDC, row-level security in Postgres, credential brokering and per-tenant keys.

75 min 1 video 3 exercises 7-question quiz Answers
Setup for the exercises:Install Claude CodePython with uvDocker and Docker ComposePostgres with pgvector

By the end of this lesson you can

  • Choose a tenancy model (pool, silo or bridge) for each layer of an agent platform
  • Trace the identity chain from user to organisation to case to agent action, and enforce it at every store
  • Replace static secrets with short-lived federated credentials, and compute the reduction in exposure window
  • Implement Postgres row-level security keyed by tenant and test that it fails closed
  • Isolate model traffic per tenant with gateway keys, budgets and cache boundaries

On this page

  • Intuition: one building, separate offices
  • Tenancy models per layer
  • Secrets: kinds, lifetimes and where they live
  • Worked example: exposure windows
  • Data isolation with row-level security
  • Model traffic, caches and spend
  • Misconceptions and limits
  • Connections
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01Intuition: one building, separate offices
  2. 02Tenancy models per layer
  3. 03Secrets: kinds, lifetimes and where they live
  4. 04Data isolation with row-level security
  5. 05Model traffic, caches and spend
  6. 06Misconceptions and limits
  7. 07Connections
  8. 08Summary

Sources & further reading

  • Selective KV-Cache Sharing to Mitigate Timing Side-Channels in LLM InferencePaper · Chu, Lin, Xiang, Shen, Su et al. · 2025Shows that sharing cached prompt prefixes across users creates an API-visible timing side channel with cross-tenant privacy risk, and proposes selective sharing. The reason cache isolation boundaries matter for multi-tenant agents.
  • Securely deploying AI agentsLab research · AnthropicSecurity boundaries, least privilege and the proxy pattern for credentials, with concrete container hardening. The section on credential management is the core of this lesson's secrets design.
  • Guidelines for secure AI system developmentLab research · UK National Cyber Security Centre · 2023The UK government's guidelines, organised into secure design, development, deployment and operation. The deployment section on protecting infrastructure is the governance frame for the controls here.
  • OpenID Connect (OIDC) FederationDocs · VercelShort-lived tokens signed by Vercel's identity provider, exchanged for cloud credentials, with a two-hour TTL for function tokens. The replacement for long-lived keys in environment variables.
  • Row Security PoliciesDocs · PostgreSQLDefault-deny when RLS is enabled with no policy, table owners bypassing RLS unless FORCE is set, and superusers and BYPASSRLS roles always bypassing. Read these three rules before trusting RLS.
  • Row Level Security (Supabase)Docs · SupabaseRLS policies with auth.uid(), wrapping auth functions in select for performance, and the warning that the service role bypasses RLS and must stay server-side.
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 8 more sections
  • 3 hands-on exercises
  • A 7-question quiz
  • Progress, quiz scores and bookmarks