Commit e16a64e
authored
fix(langgraph-threads): restore A2UI tool docstrings dropped in compaction rewrite (CopilotKit#4216)
## Summary
The Apr 21 commit
[\`25f6f1541\`](CopilotKit@25f6f1541)
(\"refactor(runtime): Support durable compaction of threads\") re-added
\`a2ui_dynamic_schema.py\` and \`a2ui_fixed_schema.py\` to the
\`langgraph-python-threads\` example (they had been deleted in the
earlier \"fix(examples): Pin version number and simplify example\"
commit). The re-add stripped two docstrings whose content was
load-bearing for the sub-LLM, not cosmetic:
- **\`render_a2ui\`** — its Args block said *\"The root component must
have id 'root'\"*. Without it, the secondary LLM emits a valid flat
component list with no entry point. The A2UI renderer always starts at
\`id=\"root\"\`
([\`A2uiSurface.tsx:152\`](packages/a2ui-renderer/src/react-renderer/a2ui-react/A2uiSurface.tsx)),
falls through to its shimmer placeholder, and the *Sales Dashboard (A2UI
Dynamic)* demo renders as an empty ~30px white square with 13 unused
components queued on the surface.
- **\`search_flights\`** — its Args block spelled out airline logo URLs,
date format, and status-icon colors, keeping flight cards visually
consistent across runs.
## What this PR does
Copies both files verbatim from
\`examples/integrations/langgraph-python/agent/src/\` (the non-threads
example, which is the known-good template). After this PR, \`diff -r\`
between the two examples' \`agent/src/\` dirs is clean.
Verified end-to-end locally against a demo scaffolded from this
template: \"Sales Dashboard (A2UI Dynamic)\" now renders the full
dashboard (title, three metric cards, pie + bar charts) instead of the
shimmer placeholder.
## Notes
- The restore brings back \`[A2UI-DEBUG]\` print statements and the
fuller module headers. If the \`-threads\` version was meant to be
terser than the non-threads version, happy to strip those in a follow-up
— but verbatim parity seemed like the safer default since the two
templates are otherwise meant to match.
- A separate, complementary fix would be to make the \`id: \"root\"\`
requirement explicit in \`A2UI_DEFAULT_GENERATION_GUIDELINES\`
(\`packages/shared/src/a2ui-prompts.ts\` +
\`sdk-python/copilotkit/a2ui.py\`), so the invariant doesn't depend on
per-demo tool docstrings. Not in scope here.
## Test plan
- [x] Run the template locally, click *Sales Dashboard (A2UI Dynamic)*,
confirm the dashboard renders.
- [ ] Sanity-check *Search Flights (A2UI Fixed Schema)* in CI or locally
— should continue to work (this file's behavior is unchanged; only
docstring content differs).
- [ ] Reviewer to decide whether to keep or strip debug prints.4 files changed
Lines changed: 82 additions & 17 deletions
File tree
- examples/integrations/langgraph-python-threads/apps/agent/src
- sdk-python/copilotkit
Lines changed: 56 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
10 | | - | |
11 | | - | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| 19 | + | |
| 20 | + | |
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
| |||
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
26 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
27 | 41 | | |
28 | 42 | | |
29 | 43 | | |
30 | 44 | | |
31 | 45 | | |
32 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
33 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
34 | 59 | | |
35 | 60 | | |
36 | | - | |
37 | | - | |
| 61 | + | |
38 | 62 | | |
39 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
40 | 67 | | |
41 | 68 | | |
42 | | - | |
43 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
44 | 80 | | |
45 | 81 | | |
| 82 | + | |
46 | 83 | | |
47 | 84 | | |
48 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
49 | 88 | | |
50 | 89 | | |
51 | 90 | | |
52 | 91 | | |
| 92 | + | |
53 | 93 | | |
54 | | - | |
55 | | - | |
56 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
57 | 97 | | |
58 | 98 | | |
59 | | - | |
| 99 | + | |
60 | 100 | | |
61 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
41 | | - | |
42 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
43 | 56 | | |
44 | 57 | | |
45 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
120 | 125 | | |
121 | 126 | | |
122 | 127 | | |
| |||
0 commit comments