Conversation
Replace `create_agent` from langchain with `create_deep_agent` from the deepagents package. This enables proper skills management with progressive disclosure instead of injecting ~47KB of skill text into the system prompt. - Convert 3 skill .txt files to SKILL.md format in subdirectories - Remove old skills/__init__.py loader (deepagents handles discovery) - Add `skills=` parameter pointing to skills directory - Add deepagents dependency to pyproject.toml Closes #47
The deepagents API uses `context_schema` parameter instead of `state_schema` from the old create_agent API.
… iframe External scripts (e.g. Three.js from CDN) were appended via DOM and loaded asynchronously, so inline scripts that depend on them would execute before the library was available. Now scripts are chained sequentially — each external script waits for onload before the next script runs. Also preserves the script `type` attribute (needed for `type="module"`) and adds CDN origins to CSP `connect-src` so dynamic imports and fetch from allowed CDNs work in the sandboxed iframe.
GeneralJerel left a comment
There was a problem hiding this comment.
Review: Upgrade to LangChain deep agents
4 commits, 8 files changed (+89, -73)
Two logically distinct changes bundled together:
- Agent migration:
create_agent→create_deep_agentwith skills-based architecture - Widget renderer fix: Sequential CDN script loading + CSP expansion
Agent Migration (main.py, skills/, pyproject.toml)
Clean migration:
state_schema→context_schema(fixed in second commit)- Skill text injection (~47KB in system prompt) replaced by directory-based discovery via
skills=param - Old
skills/__init__.pyloader properly removed - Skills converted to
SKILL.mdfrontmatter format in subdirectories
Minor observations:
deepagents>=0.1.0— no upper bound on a 0.x package. A breaking change in 0.2.0 could silently break things. Consider pinning tighter (e.g.>=0.1.0,<0.2.0).allowed-tools: []is empty in all three SKILL.md files — intentional? If deep agents support tool-gating per skill, worth documenting why.- Skill content diffs are just Unicode → ASCII substitutions (
→→->,×→x,≈→~) — encoding normalization, not content changes.
Widget Renderer (widget-renderer.tsx)
Good fix. The forEach → recursive runScripts change correctly solves the race condition where inline scripts ran before their CDN dependencies loaded.
- External scripts chain via
onload/onerrorbefore advancing - Inline scripts execute synchronously and advance immediately
typeattribute preserved (needed fortype="module")- Error handling continues the chain on failure
CSP connect-src expansion adds 4 CDN origins, consistent with the existing script-src allowlist. Reasonable given the sandboxed iframe context.
Note: reportHeight() fires immediately after starting the async script chain, so height may be stale until external scripts finish rendering. The existing ResizeObserver + periodic interval mitigates this, but if users see a brief layout jump after CDN scripts load, that's why.
README
Docs updated accurately.
Verdict
LGTM with minor suggestion to tighten deepagents version constraint. Widget renderer fix is solid, agent migration is clean.
Summary
langchain.agents.create_agentwithdeepagents.create_deep_agent.txtfiles toSKILL.mdformat in subdirectories for proper deep agent skill discoveryskills/__init__.pyloader — deep agents handle skill loading via theskills=parameterdeepagents>=0.1.0dependencyWhy
Deep agents provide a proper skills system with progressive disclosure (only loading skill details when relevant), plus built-in planning, sub-agents, and filesystem tools. This replaces the current approach of injecting ~47KB of raw skill text into the system prompt.
What changed
apps/agent/main.pycreate_agent→create_deep_agent, removed skill text injection, addedskills=paramapps/agent/pyproject.tomldeepagents>=0.1.0apps/agent/skills/__init__.pyapps/agent/skills/*.txtskills/*/SKILL.mdformat with frontmatterNo frontend changes — the
graphexport shape,CopilotKitMiddleware, andAgentStatecontract are all unchanged.Test plan
pnpm dev:agentboots without import errorsskills/directorywidgetRendererworksquery_datatool still worksCloses #47
🤖 Generated with Claude Code