Skip to main content
Every recipe follows one rule: build the shared object once, without a user, and attach the user on each call or each run, after your own sign-in check. Each section also names the dangerous pattern: a user set on something shared. That sends every request, for every user, as one user, so one user’s facts reach everyone. The recipes use the Atlaso SDK for the key, the address and the user’s headers (for_user(id).headers()). For the AI SDK, see AI SDK.

LangChain (Python)

Dangerous: ChatOpenAI(..., default_headers={"x-atlaso-user": user_id}) on an instance you share across requests.

LangChain (JavaScript)

Build the chat model inside the request, with the user’s headers. A model built this way serves only that request.
Dangerous: the same ChatOpenAI with defaultHeaders holding a user, built at module scope. There is no receipt in this recipe.

LlamaIndex

LlamaIndex needs Python 3.10 or newer. llama-index-llms-openai-like 0.7 and later declare Python 3.10 or newer (0.9 declares 3.11); on Python 3.9, pip picks an older release whose dependencies fail to import. Tested together: llama-index-llms-openai-like 0.9.0, llama-index-llms-openai 0.9.0 and openai 3.57.0 on Python 3.15.
Dangerous: an OpenAILike(default_headers={"x-atlaso-user": ...}) at module level, shared by every request. There is no receipt in this recipe.

OpenAI Agents SDK

The OpenAI Agents SDK needs Python 3.10 or newer. Use openai-agents 0.21 or later, which declares openai>=3,<4. Older releases pair with openai 2.x, and some of those pairs fail before any call (for example openai-agents 0.8.4 with openai 2.48.0). Tested together: openai-agents 0.25.0 and openai 3.57.0 on Python 3.15.
Give each run its own scoped client through RunConfig(model_provider=...), as in Example 6. Dangerous: set_default_openai_client() with a user’s client. It is global, so every concurrent run uses that user’s memory.

LiteLLM

Use the LiteLLM Python library and pass the user’s headers on each call.
LiteLLM returns the reply headers with an llm_provider- prefix in _hidden_params, which LiteLLM may change between versions. Dangerous: setting litellm.headers to a user’s headers. It is a module global, so every call from every request uses that user.

Pydantic AI

Dangerous: an AsyncOpenAI(default_headers={"x-atlaso-user": ...}) passed to a provider at module level. There is no receipt in this recipe.