Skip to content

feat(AIC-3106): add multimodal history support to graph().invoke() - #26

Open
andrewklatzke wants to merge 2 commits into
mainfrom
aklatzke/AIC-3106/add-graph-history
Open

feat(AIC-3106): add multimodal history support to graph().invoke()#26
andrewklatzke wants to merge 2 commits into
mainfrom
aklatzke/AIC-3106/add-graph-history

Conversation

@andrewklatzke

@andrewklatzke andrewklatzke commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds an optional history argument to graph().invoke() (and native graph runners), forwarded to the root node only on the first hop — subsequent nodes keep existing string-based data passing.
  • Shared compose_history helpers map LaunchDarkly-canonical multimodal content blocks to each provider’s native format (OpenAI Agents, Claude Agents/Messages, LangChain Agents/Messages).
  • Adds a graph-history integration example that asserts the model can identify a generated solid-color PNG from history.

Test plan

  • Unit tests for client graph plumbing + all handler/native-graph packages
  • Integration: uv run python main.py graph-history travel-agent-flow ""
  • Full integration suite (all integration-config.json scenarios, success + failure)
  • CI green on this PR

Note

Overview
graph().invoke() now accepts optional history and passes it to the root node only on the first hop; later graph nodes keep string-based threading.

A new client compose_history module (plus exports like content_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, LangChain image_url). Native graph runners (Claude/OpenAI/LangChain) accept history on invoke and seed the root prompt/state only.

Adds a graph-history example (generated red PNG + color check) and solid_color_png_base64 helper; README/main.py document the new example.

Reviewed by Cursor Bugbot for commit 6626b3a. Bugbot is set up for automated code reviews on this repo. Configure here.

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>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.

Fix All in Cursor

❌ 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.

Comment thread packages/claude-messages/src/launchdarkly_ai_claude_messages/handler.py Outdated
Comment thread packages/openai-agents/src/launchdarkly_ai_openai_agents/handler.py
- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant