You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -55,41 +56,42 @@ At this point you should have CopilotKit hooked into your application, connected
55
56
56
57
The next step is to configure the Remote Endpoint to serve LangGraph agents.
57
58
58
-
**Modify your server.py file (setup in step (2)) to serve LangGraph agents:**
59
+
First, find your `CopilotKitSDK` instance in your Python Remote Endpoint (typically `server.py`). <br/>
60
+
**Then modify your `CopilotKitSDK` instance (setup in the previous step) to serve LangGraph agents:**
59
61
60
62
```python title="server.py"
61
-
from fastapi import FastAPI
63
+
from copilotkit import CopilotKitSDK, LangGraphAgent # [!code highlight]
64
+
from .agent import the_langraph_graph # Import your LangGraph agent; in this example, it's the variable named `the_langraph_graph` in ./agent.py # [!code highlight]
62
65
from copilotkit.integrations.fastapi import add_fastapi_endpoint
63
-
from copilotkit import CopilotKitSDK, LangGraphAgent
66
+
# ... other imports
64
67
65
68
app = FastAPI()
66
69
67
-
# Import your LangGraph agent; in this example, it's the variable
68
-
# named `basic_agent_graph` in ./agent.py
69
-
from .agent import basic_agent_graph
70
+
# ...
70
71
71
-
# Initialize the agent for use by CopilotKit; we'll name it "basic_agent"
Remember the name `basic_agent` as well as our API endpoint URL (`http://localhost:8000/copilotkit_remote`), we'll need them as we move on to integrating this agent into the frontend.
94
+
Remember the name `basic_agent`, we'll need it as we move on to integrating this agent into the frontend.
93
95
</Callout>
94
96
95
97
</Step>
@@ -98,26 +100,23 @@ def main():
98
100
99
101
<Step>
100
102
101
-
## Agent-lock your Copilot to the `base_agent` agent.
103
+
## Agent-lock your Copilot to the `basic_agent` agent.
102
104
103
105
CopilotKit supports router-mode as well as agent-lock mode. For more detail see [router-mode / agent-mode](/coagents/advanced/router-mode-agent-lock).
106
+
In short: agent-lock modes locks your Copilot to a single LangGraph agent;
107
+
router-mode automatically routes requests to the right agent based on the user's context and query.
104
108
105
-
In short: agent-lock modes locks your Copilot to a single LangGraph agent.
106
-
Router-mode automatically routes requests to the right agent based on the user's context and query.
107
-
108
-
**For simplicity, wel'll use agent-lock mode in these tutorials,** but in production use-cases you will likely want to use router-mode.
109
+
**For simplicity, we'll use agent-lock mode in these tutorials,** but in production use-cases you will likely want to use router-mode.
109
110
110
111
Lock the Copilot to the `basic_agent` setup earlier. This means every single interaction with the Copilot will be forwarded to the locked agent.
111
112
112
113
```tsx filename="src/page.tsx"
113
-
// This UI will now invoke our AI agent, not just the LLM
0 commit comments