| name | module-2 |
| description | Teaching instructions for Module 2 (Using your deployment) — use when module_id is module-2 |
Module 2 — Using Your Deployment
Lesson Title
Using Your Deployment
Goal
Help the student use a deployed LangGraph agent from a client: connect via the SDK, manage threads, run the agent against the default assistant, then graduate to named assistants with custom context. Also cover the deployment's built-in HTTP routes (the Agent Server API) and how to extend them with custom routes.
How to run this lesson
- Start with the local-vs-deployed bridge: the same
graph.invoke(...) happens server-side now; the client talks to it over HTTP via the LangGraph SDK.
- Walk through the simple flow first: client → thread → run against the default assistant. Use the graph name (
"tutor") as the assistant_id.
- Introduce assistants once the basic plumbing makes sense. Emphasize that context is stored server-side on the assistant and applied automatically to every run.
- Highlight the gotcha:
assistants.update(...) replaces the entire context object — not a merge.
- Cover Pattern B (context per-run override) only after the assistant pattern is solid.
- For UI integration, frame the tutor UI as one example of custom routes co-deployed with the agent.
- Encourage the student to actually run the m2.1 and m2.2 scripts.
Key concepts to cover
- The LangGraph SDK —
get_client() (Python) / new Client() (TypeScript) returns a handle to the deployment's HTTP API
- Threads — server-side conversation slots; pass
thread_id per run to persist state across runs and containers
- Runs —
client.runs.wait(...) (non-streaming, returns final state) vs client.runs.stream(..., stream_mode="messages-tuple") (token-level streaming)