Skip to content

Conversation

eyurtsev
Copy link
Collaborator

@eyurtsev eyurtsev commented Oct 8, 2025

Adding thinking in langgraph

@github-actions github-actions bot added langgraph For docs changes to LangGraph oss labels Oct 8, 2025
Copy link
Contributor

github-actions bot commented Oct 8, 2025

Preview ID generated: preview-wayofl-1759950434-e82b2d5

@eyurtsev eyurtsev marked this pull request as ready for review October 9, 2025 15:59
@Copilot Copilot AI review requested due to automatic review settings October 9, 2025 15:59
Copy link
Contributor

@Copilot 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 introduces a comprehensive tutorial document titled "Thinking in LangGraph" that guides developers through the thought process and methodology for building agents with LangGraph. The tutorial uses a customer support email agent as a practical example to demonstrate the framework's concepts and best practices.

Key changes:

  • New tutorial document covering the 5-step process for building LangGraph agents
  • Integration of the new document into the documentation navigation structure

Reviewed Changes

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

File Description
src/oss/langgraph/thinking-in-langgraph.mdx New comprehensive tutorial document explaining LangGraph agent development methodology with practical examples
src/docs.json Added navigation entry for the new thinking-in-langgraph tutorial in the LangGraph section

Comment on lines +301 to +303

llm = ChatOpenAI(model="gpt-4")

Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

API key configuration is exposed in the code example. Consider showing environment variable usage or configuration patterns instead of direct instantiation to avoid exposing credentials.

Suggested change
llm = ChatOpenAI(model="gpt-4")
import os
# Read API key from environment variable for security
openai_api_key = os.environ.get("OPENAI_API_KEY")
if not openai_api_key:
raise RuntimeError("OPENAI_API_KEY environment variable not set")
llm = ChatOpenAI(model="gpt-4", api_key=openai_api_key)

Copilot uses AI. Check for mistakes.

└─────────────┘
```

Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

The Mermaid diagram appears to duplicate the ASCII diagram above it (lines 35-72). The node names in the Mermaid diagram don't match the ASCII version (e.g., 'write_response' vs 'Draft Reply'). Consider removing one diagram or ensuring they show complementary information with consistent naming.

Copilot uses AI. Check for mistakes.

@Copilot Copilot AI review requested due to automatic review settings October 9, 2025 19:14
Copy link
Contributor

@Copilot 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

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

Comment on lines +301 to +302

llm = ChatOpenAI(model="gpt-4")
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

Hard-coded model configuration without API key management. Consider using environment variables or configuration files for API credentials and model settings.

Suggested change
llm = ChatOpenAI(model="gpt-4")
import os
llm = ChatOpenAI(model=os.environ.get("OPENAI_MODEL", "gpt-4"))

Copilot uses AI. Check for mistakes.

Copy link
Contributor

github-actions bot commented Oct 9, 2025

Preview ID generated: preview-wayofl-1760037402-d2562fa

@@ -0,0 +1,568 @@
---
title: Thinking in LangGraph
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
title: Thinking in LangGraph
title: LangGraph design patterns

What about something like this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I like thinking in langgraph more (I think it's clearer that it's more of a conceptual walk through than design patterns). We can poll more folks?

Copy link
Contributor

Preview ID generated: preview-wayofl-1760197058-0726af2

@Copilot Copilot AI review requested due to automatic review settings October 12, 2025 02:18
Copy link
Contributor

@Copilot 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

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

Comments suppressed due to low confidence (1)

src/oss/langgraph/thinking-in-langgraph.mdx:1

  • The navigation path references 'oss/python/langgraph/thinking-in-langgraph' but the actual file is located at 'oss/langgraph/thinking-in-langgraph.mdx'. This path mismatch will result in a broken navigation link.
---

from langchain_openai import ChatOpenAI
from langchain_core.messages import HumanMessage

llm = ChatOpenAI(model="gpt-4")
Copy link

Copilot AI Oct 12, 2025

Choose a reason for hiding this comment

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

API key configuration is exposed in the code example. Consider using environment variables or configuration patterns to avoid exposing API keys in documentation.

Copilot uses AI. Check for mistakes.

## Step 1: Map out your workflow as discrete steps

Start by identifying the distinct steps in your process. Each step will become a **node** (a function that does one specific thing). Then sketch how these steps connect to each other.

Copy link

Copilot AI Oct 12, 2025

Choose a reason for hiding this comment

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

Two different diagram formats (Mermaid and ASCII) show the same workflow. This duplication could lead to inconsistencies if one is updated but not the other. Consider using only the Mermaid diagram for consistency and maintainability.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

Preview ID generated: preview-wayofl-1760235528-c17017c

Copy link
Contributor

Preview ID generated: preview-wayofl-1760274417-6afd996

@Copilot Copilot AI review requested due to automatic review settings October 12, 2025 13:08
Copy link
Contributor

@Copilot 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

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

from langgraph.pregel import RetryPolicy
from langchain_openai import ChatOpenAI
from langchain_core.messages import HumanMessage

Copy link

Copilot AI Oct 12, 2025

Choose a reason for hiding this comment

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

The code contains a hardcoded LLM initialization without an API key parameter, but API keys should not be present in documentation examples. Consider adding a comment about environment variable configuration or use a placeholder pattern.

Suggested change
# Assumes OPENAI_API_KEY is set in your environment variables

Copilot uses AI. Check for mistakes.

from langgraph.graph import StateGraph, START, END
from langgraph.types import interrupt, Command
from langgraph.pregel import RetryPolicy
from langchain_openai import ChatOpenAI
Copy link

Copilot AI Oct 12, 2025

Choose a reason for hiding this comment

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

The import suggests OpenAI API usage but there's no guidance about API key management. Documentation should include a note about setting up environment variables like OPENAI_API_KEY for security.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

Preview ID generated: preview-wayofl-1760274552-e155104

Copy link
Contributor

Preview ID generated: preview-wayofl-1760274792-764d063

@Copilot Copilot AI review requested due to automatic review settings October 14, 2025 01:45
Copy link
Contributor

@Copilot 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

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


```python
from langgraph.checkpoint.memory import MemorySaver
from langgraph.pregel import RetryPolicy
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The import from langgraph.pregel import RetryPolicy is incorrect. RetryPolicy should be imported from langgraph.types not langgraph.pregel.

Suggested change
from langgraph.pregel import RetryPolicy
from langgraph.types import RetryPolicy

Copilot uses AI. Check for mistakes.


```typescript
import { MemorySaver } from "@langchain/langgraph";
import { RetryPolicy } from "@langchain/langgraph";
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The RetryPolicy import appears twice in this code block. Line 902 has a duplicate import that should be removed since it's already imported on line 312.

Suggested change
import { RetryPolicy } from "@langchain/langgraph";

Copilot uses AI. Check for mistakes.

Copy link
Contributor

Preview ID generated: preview-wayofl-1760406375-52ff3fe

@eyurtsev eyurtsev changed the title feat(docs): first pass at the WAY OF LANGGRAPH feat(docs): add thinking in langgraph Oct 14, 2025
Copy link
Contributor

Preview ID generated: preview-wayofl-1760408456-482b16a

@eyurtsev eyurtsev merged commit f84c5c1 into main Oct 14, 2025
11 checks passed
@eyurtsev eyurtsev deleted the way_of_langgraph branch October 14, 2025 16:32
mdrxy pushed a commit that referenced this pull request Oct 14, 2025
Adding thinking in langgraph

---------

Co-authored-by: Hunter Lovell <hunter@hntrl.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

langgraph For docs changes to LangGraph oss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants