fix(langgraph): preserve input metadata#1832
Conversation
|
Closed the older #1817 so this is now the single active branch for #1809. Revalidated this branch locally: The only remote red status is the Vercel team authorization gate, which is unrelated to this Python integration change. |
ranst91
left a comment
There was a problem hiding this comment.
Thanks! Clean, focused change. One thing:
BinaryInputContent branch is not covered. The legacy branch builds content_dict and appends it directly, so metadata is dropped there while text/media preserve it. BinaryInputContent has the same optional metadata field, so wrap its append in _attach_input_metadata too for consistency.
9737fbc to
c636239
Compare
|
@he-yufeng is attempting to deploy a commit to the CopilotKit Team on Vercel. A member of the Team first needs to authorize it. |
|
Updated, thanks. The legacy Validated locally from |
Python Preview PackagesVersion
Install with uvAdd the TestPyPI index to your [[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
explicit = trueThen install the packages you need: # Core SDK
uv add 'ag-ui-protocol==0.0.0.dev1780424251' --index testpypi
# Integrations (each already depends on the matching ag-ui-protocol preview)
uv add 'ag-ui-langgraph==0.0.0.dev1780424251' --index testpypi
uv add 'ag-ui-crewai==0.0.0.dev1780424251' --index testpypi
# NOTE: ag-ui-agent-spec depends on pyagentspec (git-only, not on PyPI).
# You will need to install pyagentspec separately from its git repo.
uv add 'ag-ui-agent-spec==0.0.0.dev1780424251' --index testpypi
uv add 'ag_ui_adk==0.0.0.dev1780424251' --index testpypi
uv add 'ag_ui_strands==0.0.0.dev1780424251' --index testpypiInstall with pippip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ \
ag-ui-protocol==0.0.0.dev1780424251
Commit: a4c8d06 |
@ag-ui/a2a-middleware
@ag-ui/a2ui-middleware
@ag-ui/event-throttle-middleware
@ag-ui/mcp-apps-middleware
@ag-ui/mcp-middleware
@ag-ui/middleware-starter
@ag-ui/a2a
@ag-ui/adk
@ag-ui/ag2
@ag-ui/agno
@ag-ui/aws-strands
@ag-ui/claude-agent-sdk
@ag-ui/crewai
@ag-ui/langchain
@ag-ui/langgraph
@ag-ui/langroid
@ag-ui/llamaindex
@ag-ui/mastra
@ag-ui/pydantic-ai
@ag-ui/server-starter
@ag-ui/server-starter-all-features
@ag-ui/vercel-ai-sdk
@ag-ui/watsonx
@ag-ui/a2ui-toolkit
create-ag-ui-app
@ag-ui/client
@ag-ui/core
@ag-ui/encoder
@ag-ui/proto
commit: |
|
Thanks for your contribution @he-yufeng! 🚢 |
…round-trip The two multimodal converters in utils.ts were lossy: forward collapsed every image/audio/video/document part to image_url and dropped InputContent.metadata, and reverse re-emitted every image_url as type "image" with no metadata. An attachment could not survive an AG-UI -> LangGraph -> AG-UI round-trip. Forward now carries metadata (parity with merged Python ag-ui-protocol#1832) plus the original media type stashed as __agui_type inside the metadata object, and reverse restores both with a "image" fallback for untagged legacy blocks. The extra key is inert for LangChain/model providers and survives the LangGraph checkpoint JSON round-trip. Closes ag-ui-protocol#2011.
…round-trip The two multimodal converters in utils.ts were lossy: forward collapsed every image/audio/video/document part to image_url and dropped InputContent.metadata, and reverse re-emitted every image_url as type "image" with no metadata. An attachment could not survive an AG-UI -> LangGraph -> AG-UI round-trip. Forward now carries metadata (parity with merged Python ag-ui-protocol#1832) plus the original media type stashed as __agui_type inside the metadata object, and reverse restores both with a "image" fallback for untagged legacy blocks. The extra key is inert for LangChain/model providers and survives the LangGraph checkpoint JSON round-trip. Closes ag-ui-protocol#2011.
…round-trip The two multimodal converters in utils.ts were lossy: forward collapsed every image/audio/video/document part to image_url and dropped InputContent.metadata, and reverse re-emitted every image_url as type "image" with no metadata. An attachment could not survive an AG-UI -> LangGraph -> AG-UI round-trip. Forward now carries metadata (parity with merged Python ag-ui-protocol#1832) plus the original media type stashed as __agui_type inside the metadata object, and reverse restores both with a "image" fallback for untagged legacy blocks. The extra key is inert for LangChain/model providers and survives the LangGraph checkpoint JSON round-trip. Closes ag-ui-protocol#2011.
Summary
InputContent.metadatawhen converting text and media blocks into LangChain multimodal contentTo verify
.\.venv\Scripts\python.exe -m pytest tests\test_multimodal.py -qfromintegrations/langgraph/python