Commit 607fa80
fix(gettingStartedDocs): Update LangGraph example to use StateGraph API
Replace createReactAgent with StateGraph and MessagesAnnotation in the
agent monitoring getting started guide.
instrumentLangGraph works by wrapping the .compile() method on a
StateGraph to intercept the compilation step and inject tracing.
This means it must be called before .compile() is invoked.
createReactAgent calls .compile() internally and returns the
already-compiled graph — there's no hook point between graph
construction and compilation. By the time you get the return value,
the compile step has already happened, making it too late for
instrumentLangGraph to do its job.
In short: createReactAgent hides the compile step, but
instrumentLangGraph needs to wrap that exact step. They are
fundamentally incompatible with the current SDK API.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 05988cd commit 607fa80
1 file changed
Lines changed: 10 additions & 3 deletions
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
129 | 134 | | |
130 | | - | |
| 135 | + | |
131 | 136 | | |
132 | 137 | | |
133 | 138 | | |
134 | 139 | | |
| 140 | + | |
| 141 | + | |
135 | 142 | | |
136 | 143 | | |
137 | 144 | | |
| |||
0 commit comments