Configurable
Choose the supported channel for LangGraph runtime values and execution settings.
Choose the right channel
Your graph can need values from outside the graph: a user preference, the signed-in user, or an execution setting such as a recursion limit. Each kind of value has one safe channel:
| Value | Supported channel |
|---|---|
| UI preferences the model should see | Publish them with your frontend's agent-context API; see Agent Config. |
| Authentication and authorization | Send an Authorization header and validate it for every request; see Authentication. |
| Graph execution settings | Set them in the trusted backend that invokes or serves the graph. |
Do not send credentials as forwarded properties
Some LangGraph adapters merge browser-supplied forwarded properties
(forwardedProps.config) into LangGraph's RunnableConfig. Those values
remain browser-controlled and untrusted, even when a LangGraph config schema
accepts them. Never use them for credentials, tenant identity, authorization,
or server execution controls. Validate credentials at the server boundary and
pass only the resolved identity to the graph.
Model-visible UI preferences
For tone, expertise level, response length, selected records, or other non-secret values that should influence the model, publish them as agent context. The Agent Config guide shows the complete pattern and how CopilotKit middleware exposes the latest values on every turn.
Authentication
Authentication belongs in request headers, not graph state or forwarded
properties (forwardedProps). The Authentication guide covers both
LangGraph Platform and self-hosted AG-UI endpoints. In both cases, validate the
current request before the graph runs and inject only a resolved user or tenant
identifier.
Trusted graph execution settings
Set graph configuration in backend code after validating any input that influences it. Do not accept a browser-supplied configuration object wholesale.
For a self-hosted AG-UI endpoint, construct a request-local
LangGraphAGUIAgent with backend-owned configuration:
from copilotkit import LangGraphAGUIAgent
def build_agent(tenant_id: str) -> LangGraphAGUIAgent:
return LangGraphAGUIAgent(
name="sample_agent",
description="Tenant-scoped agent",
graph=graph,
config={
"configurable": {"tenant_id": tenant_id},
"recursion_limit": 50,
},
)A node can then read the validated value from the configuration supplied by the server:
from langchain_core.runnables import RunnableConfig
async def agent_node(state: AgentState, config: RunnableConfig):
tenant_id = config["configurable"]["tenant_id"]
return stateCreate the agent after authentication for each request, as shown in the self-hosted authentication guide.
What not to do
- Do not put raw credentials in model-visible context or graph state.
- Do not persist credentials merely to make them available on later turns.
- Do not trust a value merely because an adapter placed it in
RunnableConfig. - Do not let a browser choose recursion limits, callbacks, metadata, or other server execution controls.
- Do not reuse request-scoped identity between runs. Validate every request.
How is this guide?