Configurable

Choose the supported channel for LangGraph runtime values and execution settings.


Choose the right channel#

Some LangGraph adapters merge browser-supplied 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. Keep the trust boundary explicit and use the channel that matches the value:

ValueSupported channel
UI preferences the model should seePublish them with your frontend's agent-context API; see Agent Config.
Authentication and authorizationSend an Authorization header and validate it for every request; see Authentication.
Graph execution settingsSet them in the trusted backend that invokes or serves the graph.

Do not send credentials as run properties

Run properties are application payload, not an authentication or LangGraph configuration channel. 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.

In React, publish the values with useAgentContext.

Authentication#

Authentication belongs in request headers, not graph state or runtime properties. 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:

main.py
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 state

Create the agent after authentication for each request, as shown in the self-hosted authentication guide.

Set runtime context and execution controls where your trusted backend invokes the graph. recursionLimit is a top-level execution setting; your application values belong in context:

agent.ts
const result = await graph.invoke(input, {
  context: { tenantId: verifiedTenantId },
  recursionLimit: 50,
});

Read the validated context through the node's LangGraph runtime. See LangGraph's runtime configuration guide for the matching context schema and node signature.

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.