7acadae
CopilotKitDocs
  • Docs
  • Integrations
  • Reference
Get Started
QuickstartCoding Agents
Concepts
ArchitectureGenerative UI OverviewOSS vs Enterprise
Agentic Protocols
OverviewAG-UIAG-UI MiddlewareMCPA2A
Build Chat UIs
Prebuilt Components
CopilotChatCopilotSidebarCopilotPopup
Custom Look and Feel
CSS CustomizationSlots (Subcomponents)Fully Headless UIReasoning Messages
Multimodal AttachmentsVoice
Build Generative UI
Controlled
Tool-based Generative UITool RenderingState RenderingReasoning
Your Components
Display ComponentsInteractive Components
Declarative
A2UIDynamic Schema A2UIFixed Schema A2UI
Open-Ended
MCP Apps
Adding Agent Powers
Frontend ToolsShared State
Human-in-the-Loop
HITL OverviewPausing the Agent for InputHeadless Interrupts
Sub-AgentsAgent ConfigProgrammatic Control
Agents & Backends
Built-in Agent
Backend
Copilot RuntimeFactory ModeAG-UI
Runtime Server AdapterAuthentication
LangGraph (Python)
Your Components
Display-onlyInteractiveInterrupt-based
Shared state
Reading agent stateWriting agent stateInput/Output SchemasState streaming
ReadablesInterruptsConfigurableSubgraphsDeep Agents
Advanced
Disabling state streamingManually emitting messagesExiting the agent loop
Persistence
Loading Agent StateThreadsMessage Persistence
Videos
Video: Research Canvas
Error Debugging & ObservabilityCommon LangGraph issues
Troubleshooting Copilots
Migrate to AG-UI
Observe & Operate
InspectorVS Code Extension
Troubleshooting
Common Copilot IssuesError Debugging & ObservabilityDebug ModeAG-UI Event InspectorHook ExplorerError Observability Connectors
Enterprise
CopilotKit PremiumHow the Enterprise Intelligence Platform WorksHow Threads & Persistence WorkObservabilitySelf-Hosting IntelligenceThreads
Deploy
AWS AgentCore
What's New
Full MCP Apps SupportLangGraph Deep Agents in CopilotKitA2UI Launches with full AG-UI SupportCopilotKit v1.50Generative UI Spec SupportA2A and MCP Handshake
Migrate
Migrate to V2Migrate to 1.8.2
Other
Contributing
Code ContributionsDocumentation Contributions
Anonymous Telemetry
LangGraph (Python)Configurable

Configurable

Using agent execution parameters when communicating with an agent.

What is this?#

LangGraph agents are able to take execution parameters, such as auth tokens and similar properties. You can add these using this feature.

If you wish to read further, you can refer to the configuration guide by LangGraph

When should I use this?#

This is useful when you want to send execution-time configuration information (such as different tokens or metadata for a given session) that should not be part of the agent state.

Looking for authentication?

If you need to pass authentication tokens specifically, see the dedicated Authentication guide which covers LangGraph Platform and self-hosted authentication patterns in detail.

Implementation#

By default, LangGraph agents are invoked with a config argument. This config has a configurable property which can be accessed and filled with your data.

Pass configuration from the frontend#

First, pass the configuration properties as you would like to receive them in the agent.

Do not call runAgent directly in the component body: it would run on every render and can trigger errors such as thread is already processing. Use a useEffect with an empty dependency array (or call runAgent from an event handler) when you want to start the run once with a given config.

app/page.tsx
tsx
import { useAgent } from "@copilotkit/react-core/v2"; // [!code highlight]
import { useEffect } from "react";
function YourMainContent() {
  // ...

  // [!code highlight:3]
  const { agent } = useAgent({
    agentId: "sample_agent",
  });

  // Pass configuration when running the agent
  // [!code highlight:8]
  useEffect(() => {
    agent.runAgent({
      forwardedProps: {
        config: {
          configurable: {
            authToken: 'example-token'
          },
          recursion_limit: 50,
        }
      }
    });
  }, []);

  // ...

  return (... your component UI markdown)
}

Use configurables in agent#

Now you can simply pull the values from the provided config argument in any agent node

async def agent_node(state: AgentState, config: RunnableConfig):

    auth_token = config['configurable'].get('authToken', None)

    return state

Optional: Define configurables schema#

If you'd like, you can define a schema to indicate which configurables you wish to receive. Any item passed to "configurables" which is not included in the schema, will be filtered out.

You can read more about this here.

from typing import TypedDict

# define which properties will be allowed in the configuration
class ConfigSchema(TypedDict):
  authToken: str

# ...add all necessary graph nodes

# when defining the state graph, apply the config schema
workflow = StateGraph(AgentState, config_schema=ConfigSchema)
On this page
What is this?When should I use this?ImplementationPass configuration from the frontendUse configurables in agent