Skip to content

Add LangGraph optimization guide#19180

Merged
BenWilson2 merged 3 commits intomlflow:masterfrom
TomeHirata:docs/optimize-langgraph
Dec 4, 2025
Merged

Add LangGraph optimization guide#19180
BenWilson2 merged 3 commits intomlflow:masterfrom
TomeHirata:docs/optimize-langgraph

Conversation

@TomeHirata
Copy link
Collaborator

@TomeHirata TomeHirata commented Dec 3, 2025

🛠 DevTools 🛠

Open in GitHub Codespaces

Install mlflow from this PR

# mlflow
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/19180/merge
# mlflow-skinny
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/19180/merge#subdirectory=libs/skinny

For Databricks, use the following command:

%sh curl -LsSf https://raw.githubusercontent.com/mlflow/mlflow/HEAD/dev/install-skinny.sh | sh -s pull/19180/merge

Related Issues/PRs

n/a

What changes are proposed in this pull request?

Similarly to Langchain and OpenAI agents, this PR introduces the "how to guide" for optimizing LangGraph agents.

How is this PR tested?

  • Existing unit/integration tests
  • New unit/integration tests
  • Manual tests

Does this PR require documentation update?

  • No. You can skip the rest of this section.
  • Yes. I've updated:
    • Examples
    • API references
    • Instructions

Release Notes

Is this a user-facing change?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release notes for MLflow users.

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • area/tracking: Tracking Service, tracking client APIs, autologging
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/evaluation: MLflow model evaluation features, evaluation metrics, and evaluation workflows
  • area/gateway: MLflow AI Gateway client APIs, server, and third-party integrations
  • area/prompts: MLflow prompt engineering features, prompt templates, and prompt management
  • area/tracing: MLflow Tracing features, tracing APIs, and LLM tracing functionality
  • area/projects: MLproject format, project running backends
  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages

How should the PR be classified in the release notes? Choose one:

  • rn/none - No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" section
  • rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • rn/feature - A new user-facing feature worth mentioning in the release notes
  • rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • rn/documentation - A user-facing documentation change worth mentioning in the release notes

Should this PR be included in the next patch release?

Yes should be selected for bug fixes, documentation updates, and other small changes. No should be selected for new features and larger changes. If you're unsure about the release classification of this PR, leave this unchecked to let the maintainers decide.

What is a minor/patch release?
  • Minor release: a release that increments the second part of the version number (e.g., 1.2.0 -> 1.3.0).
    Bug fixes, doc updates and new features usually go into minor releases.
  • Patch release: a release that increments the third part of the version number (e.g., 1.2.0 -> 1.2.1).
    Bug fixes and doc updates usually go into patch releases.
  • Yes (this PR will be cherry-picked and included in the next patch release)
  • No (this PR will be included in the next minor release)

- Introduced a new documentation file for optimizing prompts with LangGraph.
- Updated the sidebar configuration to include the new LangGraph optimization guide.
- Added a link to the LangGraph optimization guide in the existing prompts documentation.

Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
@github-actions github-actions bot added v3.7.0 area/docs Documentation issues rn/documentation Mention under Documentation Changes in Changelogs. labels Dec 3, 2025
@TomeHirata TomeHirata added the team-review Trigger a team review request label Dec 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

Documentation preview for f850491 is available at:

Changed Pages (2)

More info
  • Ignore this comment if this PR does not change the documentation.
  • The preview is updated when a new commit is pushed to this PR.
  • This comment was created by this workflow run.
  • The documentation was built by this workflow run.

@harupy
Copy link
Member

harupy commented Dec 3, 2025

/review You're a professional doc writer. Let's polish this PR


🚀 Review workflow started


✅ Review completed.

Review Output

Perfect! I've completed the documentation review for PR #19180. Here's a summary of what I found:

Review Summary

I've reviewed the new LangGraph optimization guide with a focus on documentation quality and polish. The guide is well-structured and follows the existing documentation patterns, but I found several areas for improvement:

Issues Found (7 comments added):

  1. Introduction enhancement - The opening sentence could be more descriptive to better match the style of the LangChain and OpenAI agent guides

  2. Template string formatting - Missing period at the end of the system prompt template for better readability

  3. Step numbering consistency - Steps 4, 5, and 6 in the code comments need to be renumbered to maintain sequential order throughout the example

  4. Model consistency - The code uses gpt-4o-mini in the predict function but gpt-4o in the optimizer and scorer, which could cause confusion. I suggested either:

    • Using consistent models throughout, or
    • Adding a comment explaining why more powerful models are used for optimization

Positive aspects:

  • Code structure is clear and follows LangGraph best practices
  • The customer support agent example is practical and relatable
  • Prerequisites section matches the style of other guides
  • Good use of type hints and proper LangGraph patterns
  • Excellent alignment with existing documentation structure

All review comments have been added to the PR with specific suggestions and include clickable suggestion blocks where applicable, making it easy for the maintainers to apply the changes with one click.

@mlflow mlflow deleted a comment from github-actions bot Dec 3, 2025
@mlflow mlflow deleted a comment from github-actions bot Dec 3, 2025
@mlflow mlflow deleted a comment from github-actions bot Dec 3, 2025
@mlflow mlflow deleted a comment from github-actions bot Dec 3, 2025
@mlflow mlflow deleted a comment from github-actions bot Dec 3, 2025
@mlflow mlflow deleted a comment from github-actions bot Dec 3, 2025
Copy link
Member

@BenWilson2 BenWilson2 left a comment

Choose a reason for hiding this comment

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

Looks good once the single comment is addressed

@BenWilson2 BenWilson2 added this pull request to the merge queue Dec 4, 2025
@BenWilson2 BenWilson2 removed this pull request from the merge queue due to a manual request Dec 4, 2025
…imization.mdx

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Ben Wilson <39283302+BenWilson2@users.noreply.github.com>
Copilot AI review requested due to automatic review settings December 4, 2025 17:55
@BenWilson2 BenWilson2 enabled auto-merge December 4, 2025 17:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a comprehensive optimization guide for LangGraph agents to the MLflow documentation, extending the existing prompt optimization documentation to include support for the LangGraph framework alongside the existing LangChain and OpenAI agent guides.

  • Adds a new "LangGraph Optimization" documentation page with a complete example
  • Updates the sidebar navigation to include the new guide
  • Adds a reference link in the main optimization guide page

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
docs/sidebarsGenAI.ts Adds sidebar entry for the new LangGraph optimization guide at position 8
docs/docs/genai/prompt-registry/optimize-prompts/langgraph-optimization.mdx New comprehensive guide demonstrating how to optimize LangGraph agent prompts with a complete customer support example
docs/docs/genai/prompt-registry/optimize-prompts.mdx Adds reference link to the new LangGraph optimization guide in the framework-agnostic section

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@BenWilson2 BenWilson2 added this pull request to the merge queue Dec 4, 2025
Merged via the queue into mlflow:master with commit 245324c Dec 4, 2025
52 checks passed
BenWilson2 added a commit to BenWilson2/mlflow that referenced this pull request Dec 4, 2025
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Signed-off-by: Ben Wilson <39283302+BenWilson2@users.noreply.github.com>
Co-authored-by: Ben Wilson <39283302+BenWilson2@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
BenWilson2 added a commit that referenced this pull request Dec 4, 2025
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Signed-off-by: Ben Wilson <39283302+BenWilson2@users.noreply.github.com>
Co-authored-by: Ben Wilson <39283302+BenWilson2@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation issues rn/documentation Mention under Documentation Changes in Changelogs. team-review Trigger a team review request v3.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants