A user object that's populated from authenticated requests from the LangGraph studio.
Note: Studio auth can be disabled in your langgraph.json config.
{
"auth": {
"disable_studio_auth": true
}
}
You can use isinstance checks in your authorization handlers (@auth.on) to control access specifically
for developers accessing the instance from the LangGraph Studio UI.
Use @auth.on to deny by default, but allow Studio users through:
@auth.on
async def deny_all_except_studio(ctx: Auth.types.AuthContext, value: Any) -> bool:
# Allow Studio users, deny everyone else by default
if isinstance(ctx.user, Auth.types.StudioUser):
return True
return False
# Then add specific handlers to allow access for non-Studio users
@auth.on.threads
async def allow_thread_access(ctx: Auth.types.AuthContext, value: Any) -> Auth.types.FilterType:
return {"owner": ctx.user.identity}