Skip to content

Conversation

@TheovanKraay
Copy link
Contributor

Overview

added cosmos db sample for checkpointer in short term memory section

Type of change

Update existing documentation

Related issues/PRs

N/A

Checklist

  • I have read the contributing guidelines
  • I have tested my changes locally using docs dev
  • All code examples have been tested and work correctly
  • I have used root relative paths for internal links
  • I have updated navigation in src/docs.json if needed
  • I have gotten approval from the relevant reviewers
  • (Internal team members only / optional) I have created a preview deployment using the Create Preview Branch workflow

Additional notes

There are actually many checkpointer store implementations now: https://pypi.org/search/?q=langgraph-checkpoint. Perhaps this doc could further be revised to make that clear. However, I cannot comment authoritatively on those (I am PM in Cosmos DB engineering team). so just adding the Cosmos DB sample in addition to the existing Postgres sample.

Copilot AI review requested due to automatic review settings November 6, 2025 12:16
@github-actions github-actions bot added langchain For docs changes to LangChain oss labels Nov 6, 2025
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 documentation for using Azure Cosmos DB as a checkpoint saver for LangChain agents, providing an alternative to the existing PostgreSQL example.

Key changes:

  • Added installation instructions and Python code example for the langgraph-checkpoint-cosmosdb package
  • Included configuration details for authentication and database/container setup
  • Added a note about sync/async support and RBAC credentials

Comment on lines +127 to +136
checkpointer = CosmosDBSaver( # [!code highlight]
database_name="your_database", # [!code highlight]
container_name="your_container" # [!code highlight]
) # [!code highlight]

agent = create_agent(
"gpt-5",
[get_user_info],
checkpointer=checkpointer, # [!code highlight]
)
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The Cosmos DB example should follow the same pattern as the PostgreSQL example above (lines 92-98) by using a context manager. Consider wrapping the CosmosDBSaver initialization in a with statement to ensure proper resource cleanup, unless the CosmosDBSaver doesn't support context managers.

Suggested change
checkpointer = CosmosDBSaver( # [!code highlight]
database_name="your_database", # [!code highlight]
container_name="your_container" # [!code highlight]
) # [!code highlight]
agent = create_agent(
"gpt-5",
[get_user_info],
checkpointer=checkpointer, # [!code highlight]
)
with CosmosDBSaver( # [!code highlight]
database_name="your_database", # [!code highlight]
container_name="your_container" # [!code highlight]
) as checkpointer: # [!code highlight]
agent = create_agent(
"gpt-5",
[get_user_info],
checkpointer=checkpointer, # [!code highlight]
)

Copilot uses AI. Check for mistakes.
Comment on lines +139 to 144
<Note>
Azure Cosmos DB checkpointer supports both sync and async operations. If the database and container already exist, you can use default RBAC credentials (e.g., `az login`) instead of setting the endpoint and key.
</Note>
:::


Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The note is placed inside the :::python block, which means it will only appear in the Python-specific documentation. Since this is general information about Azure Cosmos DB (not Python-specific), consider placing it outside the :::python block to ensure it appears in all documentation versions.

Suggested change
<Note>
Azure Cosmos DB checkpointer supports both sync and async operations. If the database and container already exist, you can use default RBAC credentials (e.g., `az login`) instead of setting the endpoint and key.
</Note>
:::
:::
<Note>
Azure Cosmos DB checkpointer supports both sync and async operations. If the database and container already exist, you can use default RBAC credentials (e.g., `az login`) instead of setting the endpoint and key.
</Note>

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

langchain For docs changes to LangChain oss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant