feat(AIC-3106): add multimodal history support to graph().invoke() - #26
Merged
Merged
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>
apucacao
approved these changes
Aug 11, 2026
Resolves conflicts in main.py, six provider handlers, and their test modules, layering the PR's structured multimodal history onto main's telemetry-aware handler architecture. History forwarding stays root-only, as originally designed. Also fixes two input-fidelity bugs found while validating the merge: - claude-agents: envelope type and message.role must agree. Sending type 'user' with message.role 'assistant' was rejected by the Claude Code CLI with "Expected message role 'user', got 'assistant'". Assistant turns now use an assistant envelope. - openai-messages: restore role-aware content mapping. A role-blind mapper emitted input_text parts on assistant turns, which the Responses API accepts only on user turns. 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
Adds optional
historytograph().invoke()and framework native graph runners, passing it only to the root node on the first hop; later nodes keep string-based handoffs.Introduces shared
compose_historyand multimodal content helpers in the core client. Provider handlers (Claude/OpenAI/LangChain agents and messages) stop flattening history into the system prompt and instead build structured turns, mapping LD image/text blocks to each SDK’s native shape (streamed envelopes for Claude Agents, merged user turns for Claude Messages,input_image/image_urlelsewhere).Adds a
graph-historyexample (generated red PNG + colour check) and broad unit/integration test coverage for plumbing and wire format.Reviewed by Cursor Bugbot for commit 97dcdcd. Bugbot is set up for automated code reviews on this repo. Configure here.