feat(AIC-3106): add multimodal history support to graph().invoke() - #26
Open
andrewklatzke wants to merge 2 commits into
Open
feat(AIC-3106): add multimodal history support to graph().invoke()#26andrewklatzke wants to merge 2 commits into
andrewklatzke wants to merge 2 commits into
Conversation
Forward optional conversation history to the root node only, with provider-native multimodal content blocks across agents and messages handlers, plus a graph-history integration example. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit da9b323. Configure here.
- claude-messages: merge consecutive same-role turns so image-in-history plus a userInput question is sent as one user message (Anthropic requires alternating roles). - openai-messages: only route through compose_history when history is present, so an instructions-only config with empty input still sends a user turn (empty history == no history). - openai-agents: skip config.messages in history composition when config.instructions is set, matching the no-history priority (handler + native graph). Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
historyargument tograph().invoke()(and native graph runners), forwarded to the root node only on the first hop — subsequent nodes keep existing string-based data passing.compose_historyhelpers map LaunchDarkly-canonical multimodal content blocks to each provider’s native format (OpenAI Agents, Claude Agents/Messages, LangChain Agents/Messages).graph-historyintegration example that asserts the model can identify a generated solid-color PNG from history.Test plan
uv run python main.py graph-history travel-agent-flow ""integration-config.jsonscenarios, success + failure)Note
Overview
graph().invoke()now accepts optionalhistoryand passes it to the root node only on the first hop; later graph nodes keep string-based threading.A new client
compose_historymodule (plus exports likecontent_to_text,image_block_to_url) standardizes how runtime history is ordered and how LD-canonical text/image blocks map to each provider.Provider handlers stop flattening history into system prompts and instead send structured turns (e.g. Anthropic image blocks with adjacent-user merge, OpenAI
input_image, LangChainimage_url). Native graph runners (Claude/OpenAI/LangChain) accepthistoryoninvokeand seed the root prompt/state only.Adds a
graph-historyexample (generated red PNG + color check) andsolid_color_png_base64helper; README/main.pydocument the new example.Reviewed by Cursor Bugbot for commit 6626b3a. Bugbot is set up for automated code reviews on this repo. Configure here.