Managed Deep Agents is in public beta and available on LangSmith Cloud in the US region only.
Add identity
Createidentity.py or identity.ts at the project root and export a named identity declaration:
auth, which controls how Managed Deep Agents authenticates callers.
Managed Deep Agents supplies the remaining identity behavior:
- Threads: Each thread belongs to the authenticated caller. Requests cannot select another caller’s thread owner.
- Runtime identity: Tools and middleware receive the verified caller through
runtime.identity.
scope, credentials, connect, or memory options to defineIdentity(...) or define_identity(...).
Adding identity to an existing deployment does not add owner metadata to existing threads. Plan and test a migration before relying on identity-based access for those threads.
Choose how callers authenticate
Theauth option supports two patterns:
- Backend authentication: Your backend authenticates the caller and sends trusted identity headers. This is the default.
- Validated-token authentication: The caller sends an identity-provider token that Managed Deep Agents verifies.
Use backend authentication
Use backend authentication when your application server already authenticates users through a session, OAuth flow, or another mechanism. Your server proxies requests to the deployment with these headers:
The argument-free declaration selects this mode. You can also set it explicitly:
MDA_INGRESS_SECRET as a hosted deployment secret. mda dev configures local identity automatically, so local Studio requests do not require these headers.
Backend authentication accepts only the caller id from the public identity headers. It does not accept groups, email, organization, or arbitrary claims from the client.
Use validated-token authentication
Use validated-token authentication when a browser or another client calls the deployment directly. The client sends:auth.supabase(...) to authenticate callers with Supabase.
Authenticate with Supabase
Configure Supabase with a project reference or project URL:Authorization header. By default, Managed Deep Agents verifies JWTs against Supabase JWKS. Pass url for a custom auth domain.
Use runtime.identity
Tools and middleware receive a frozen identity object built from the trusted authentication result. Client-supplied identity keys in the normal configurable payload are not trusted.
The identity contains:
user: The caller’sid,kind, and optionalemail.groups: Optional group memberships mapped from a validated token.source: The run’s ingress provider and optional source thread id.claims: Optional verified token claims.
ManagedDeepAgentRuntime for typed access:
runtime.identity["source"]["thread_id"]. In TypeScript, read it as runtime.identity.source.threadId.
Use verified identity for personalization, audit records, and authorization decisions. Do not trust a user id supplied in a tool argument or request body.
Understand identity boundaries
Identity provides a fixed user boundary rather than configurable scope axes:- Threads are always per caller.
- Validated-token groups and claims are available for authorization logic, but they do not change thread ownership.
- Durable memory is configured in
memory.pyormemory.tsand is shared across the deployment.
Test and deploy
Test the project locally withmda dev, then deploy it with mda deploy. Open deployment traces in LangSmith to inspect model calls, tool calls, errors, and latency.
Authentication failures return 401. Attempts to access another caller’s thread return 403. For backend authentication, confirm that the deployment has MDA_INGRESS_SECRET and that your proxy sends both reserved headers.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

