Skip to content

feat: Added tutorial and warnings for langchain orchestration template - #572

Open
BrigittaK307 wants to merge 9 commits into
mainfrom
I753325-438
Open

feat: Added tutorial and warnings for langchain orchestration template#572
BrigittaK307 wants to merge 9 commits into
mainfrom
I753325-438

Conversation

@BrigittaK307

@BrigittaK307 BrigittaK307 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Comment on lines +2 to +4
id: langgraph-orchestration-client
title: Using Orchestration Client in LangGraph Workflows
sidebar_label: Orchestration Client in LangGraph

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
id: langgraph-orchestration-client
title: Using Orchestration Client in LangGraph Workflows
sidebar_label: Orchestration Client in LangGraph
id: langgraph-template-orchestration-client
title: Using Orchestration Templates in LangGraph Agents
sidebar_label: Using Orchestration Templates in LangGraph Agents

}
});
```

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[pp] As a tutorial, I would prefer if there was something e.g. at the bottom for both that shows how to combine these into an actual LangGraph (or maybe createAgent()...)

Comment on lines +73 to +77
:::warning
When using `template`, its messages are **always prepended** to every `invoke()` or `stream()` call — reusing the same client across multiple turns causes the template to appear on every request.
When using `template_ref`, any messages passed are **automatically routed to `messages_history`** and cannot be merged into the remotely stored template.
In both cases, use the **two-client pattern** from the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client): one client with the template for the first turn, a second without it for follow-up turns.
:::

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
:::warning
When using `template`, its messages are **always prepended** to every `invoke()` or `stream()` call — reusing the same client across multiple turns causes the template to appear on every request.
When using `template_ref`, any messages passed are **automatically routed to `messages_history`** and cannot be merged into the remotely stored template.
In both cases, use the **two-client pattern** from the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client): one client with the template for the first turn, a second without it for follow-up turns.
:::
When using `template`, its messages are **always prepended** to every `invoke()` or `stream()` call — reusing the same client across multiple turns causes the template to appear on every request.
When using `template_ref`, any messages passed are **automatically routed to `messages_history`** and cannot be merged into the remotely stored template.
In both cases, you can use the **two-client pattern** from the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client) to avoid related issues while taking advantage of the prompt registry: one client with the template for the first turn, a second without it for follow-up turns.

Comment on lines +235 to +240
.addConditionalEdges(START, routeByTurn, [
'firstTurnNode',
'conversationNode'
])
.addEdge('firstTurnNode', END)
.addEdge('conversationNode', END)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[pp] I think there should be edge from START -> firstTurnNode -> conversationNode with a conditional edge from conversationNode to itself or END (in this case perhaps just END).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The graph re-enters from START on every graph.invoke() call. Adapting the firstTurnNode → conversationNode case would cause both nodes to fire on turn 1, making two LLM calls instead of one.

When using the `template_ref` property, messages passed to the `chatCompletion()` or `stream()` methods are automatically appended to the `messages_history` array as they cannot be merged into the stored prompt template.
The `messages` property defined in the `template` array are appended after any existing `messagesHistory` entries.
:::warning
Messages passed alongside a `template_ref` are **automatically routed to `messages_history`** and cannot be merged into the remotely stored template. See the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client) for the recommended two-client pattern in multi-turn workflows.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Messages passed alongside a `template_ref` are **automatically routed to `messages_history`** and cannot be merged into the remotely stored template. See the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client) for the recommended two-client pattern in multi-turn workflows.
Messages passed alongside a `template_ref` are **automatically routed to `messages_history`** and cannot be merged into the remotely stored template. See the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client) for the recommended two-client pattern in multi-turn workflows with template references.

When initializing the client with an orchestration configuration reference, any messages passed to the `chatCompletion()` or `stream()` methods are automatically appended to the `messages_history` array as they cannot be merged into the stored configuration's prompt template.
The `messages` property defined in the `template` array are appended after any existing `messagesHistory` entries.
:::warning
Messages passed alongside a configuration reference are **automatically routed to `messages_history`** and cannot be merged into the remotely stored configuration's prompt template. See the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client) for the recommended two-client pattern in multi-turn workflows.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Messages passed alongside a configuration reference are **automatically routed to `messages_history`** and cannot be merged into the remotely stored configuration's prompt template. See the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client) for the recommended two-client pattern in multi-turn workflows.
Messages passed alongside a configuration reference are **automatically routed to `messages_history`** and cannot be merged into the remotely stored configuration's prompt template. See the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client) for the recommended two-client pattern in multi-turn workflows with configuration references.

The `promptTemplating.prompt.template` messages defined in the client configuration are static - they are always included in every `chatCompletion()` request.
For more dynamic prompts, i.e., you want to vary the full message list per request without re-initializing the client, use the `messages` property instead.
:::warning
Template messages are **always prepended** to every request. Reusing the same client across multiple turns will include the template on every call. See the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client) for how to avoid duplication in multi-turn workflows.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Template messages are **always prepended** to every request. Reusing the same client across multiple turns will include the template on every call. See the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client) for how to avoid duplication in multi-turn workflows.
Template messages are **always prepended** to every request. Reusing the same client across multiple turns will include the template on every call. See the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client) for how to avoid duplication in multi-turn workflows with prompt templates.

const agent = createAgent({
model: clientWithTemplate,
tools: [],
checkpointSaver: new MemorySaver()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
checkpointSaver: new MemorySaver()
checkpointer: new MemorySaver()

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.

2 participants