Skip to main content

A lightweight library for langgraph that provides useful shortcuts and additional utility functions.

Project description

Crimson LangGraph Development Tools

A lightweight library for LangGraph that provides useful shortcuts and additional utility functions.

PyPI - Version PyPI - Python Version

Installation

pip install crimson-langgraph-dev-tool

Overview

This library provides a set of tools and examples to make working with LangGraph easier and more efficient. It includes utility functions for visualization and a collection of examples demonstrating common patterns and use cases.

Modules

crimson.langgraph_dev_tool.display

This module contains functions for visualizing LangGraph objects:

  • display_graph(graph): Renders a compiled state graph as a Mermaid diagram in Jupyter notebooks

Example usage:

from crimson.langgraph_dev_tool.display import display_graph
from langgraph.graph import StateGraph

# Create your graph
builder = StateGraph(State)
# Add nodes and edges
# ...
graph = builder.compile()

# Display the graph
display_graph(graph)

Examples

The repository includes several examples demonstrating the use of LangGraph in different scenarios:

Conditional Edge Examples

Located in example/langgraph/conditional_edge.ipynb

This example demonstrates how to use conditional edges in LangGraph to create dynamic branching logic based on state conditions. It covers:

  • Basic conditional branching
  • Using typed dictionaries for state management
  • Creating functions that return a list of destinations
  • Using RunnableLambda with conditional edges
  • Adding listeners for debugging and monitoring

Highlights:

  • Using route_chars function to conditionally route to multiple nodes
  • Demonstrating the differences between using a Callable vs a Runnable for path selection
  • Examples of advanced typehints and their usage in LangGraph

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crimson_langgraph_dev_tool-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crimson_langgraph_dev_tool-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file crimson_langgraph_dev_tool-0.1.0.tar.gz.

File metadata

File hashes

Hashes for crimson_langgraph_dev_tool-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c36347533d7e2ec0df09ae223cd9ba9946117e4054a25ef8d968ba0afb729aa1
MD5 c8cf13981b326ee53b2c756ba38d5ef7
BLAKE2b-256 8b33d2f7a103aa68cfa2189ecb32c15283b573196a1bb3c1f3a7363ca0e39a6d

See more details on using hashes here.

File details

Details for the file crimson_langgraph_dev_tool-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for crimson_langgraph_dev_tool-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 27577531b629499a2242a366758f311ddbee6fd0442d255a823d062053bf27cf
MD5 fdde24ec20ed012de72fc71e43c3c827
BLAKE2b-256 f8d3aaa9d0bef9ae8cd1979000b4592006dbdb85299e5ef775e07df4b5e99fa4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page