From f1e6ce4a813eba11eeb036a014cd655f615847fd Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 24 Nov 2025 18:59:32 -0500 Subject: [PATCH 1/2] release: pyproject.toml reverted to v0.1.0a1 for official release --- sdk/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/pyproject.toml b/sdk/pyproject.toml index 0e99649..40b37a7 100644 --- a/sdk/pyproject.toml +++ b/sdk/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] # This is the main SDK package name name = "codon_sdk" -version = "0.1.0a4" +version = "0.1.0a1" license = {text = "Apache-2.0"} authors = [ { name="Codon, Inc.", email="martin@codonops.ai" }, From 3c30999fd8c9d6f2ee1daa41153c933664da6dbe Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 24 Nov 2025 19:24:55 -0500 Subject: [PATCH 2/2] ops: Updated pyproject.toml and README for langgraph adapter for deployment to PyPi --- .../codon-instrumentation-langgraph/README.md | 70 ++++++++++++------- .../pyproject.toml | 15 ++-- 2 files changed, 54 insertions(+), 31 deletions(-) diff --git a/instrumentation-packages/codon-instrumentation-langgraph/README.md b/instrumentation-packages/codon-instrumentation-langgraph/README.md index e4acd81..6a58720 100644 --- a/instrumentation-packages/codon-instrumentation-langgraph/README.md +++ b/instrumentation-packages/codon-instrumentation-langgraph/README.md @@ -1,40 +1,56 @@ # Codon LangGraph Adapter -This adapter lets you wrap an existing LangGraph `StateGraph` inside Codon’s `CodonWorkload`. By doing so you inherit: +If you're already using LangGraph, the Codon SDK provides seamless integration through the `LangGraphWorkloadAdapter`. This allows you to wrap your existing StateGraphs with minimal code changes while gaining comprehensive telemetry and observability. -- automatic `NodeSpec` creation and logic ID generation -- OpenTelemetry spans through `track_node` -- the token-based runtime with audit ledger +## Understanding State Graph vs Compiled Graph + +LangGraph has two distinct graph representations: +- **State Graph**: The graph you define and add nodes to during development +- **Compiled Graph**: The executable version created when you want to run the graph + +The `LangGraphWorkloadAdapter` works by wrapping your StateGraph and compiling it for you, allowing you to pass compile keyword arguments for features like checkpointers and long-term memory. + +## Using LangGraphWorkloadAdapter + +The primary way to integrate LangGraph with Codon is through the `LangGraphWorkloadAdapter.from_langgraph()` method: -## Quick Start ```python +from langgraph.graph import StateGraph +from langgraph.checkpoint.memory import MemorySaver from codon.instrumentation.langgraph import LangGraphWorkloadAdapter -from myproject.langgraph import graph -workload = LangGraphWorkloadAdapter.from_langgraph( - graph, - name="LangGraphAgent", - version="1.0.0", +# Your existing StateGraph +db_agent_graph = StateGraph(SQLAnalysisState) +db_agent_graph.add_node("query_resolver_node", self.query_resolver_node) +db_agent_graph.add_node("query_executor_node", self.query_executor_node) +# ... add more nodes and edges + +# Wrap with Codon adapter +self._graph = LangGraphWorkloadAdapter.from_langgraph( + db_agent_graph, + name="LangGraphSQLAgentDemo", + version="0.1.0", + description="A SQL agent created using the LangGraph framework", + tags=["langgraph", "demo", "sql"], + compile_kwargs={"checkpointer": MemorySaver()} ) +``` -result = workload.execute({"state": initial_state}, deployment_id="dev") +### Automatic Node Inference -# Adding compile-time extras (e.g., checkpointer) -from langgraph.checkpoint.memory import InMemorySaver +The adapter automatically infers nodes from your StateGraph, eliminating the need to manually instrument each node with decorators. This provides comprehensive telemetry out of the box. -workload_with_ckpt = LangGraphWorkloadAdapter.from_langgraph( - graph, - name="LangGraphAgent", - version="1.0.0", - compile_kwargs={"checkpointer": InMemorySaver()}, -) +**Note:** Only fired nodes are represented in a workload run, so the complete workload definition may not be present in the workload run summary. This is particularly relevant for LangGraph workflows with conditional edges and branching logic—your execution reports will show actual paths taken, not all possible paths. -# Override or extend at invocation time if needed -run = workload_with_ckpt.execute( - {"state": initial_state}, - deployment_id="dev", - langgraph_config={"metadata": "run-123"}, -) -``` +### Compile Keyword Arguments + +You can pass any LangGraph compile arguments through `compile_kwargs`: +- Checkpointers for persistence +- Memory configurations +- Custom compilation options + +## Best Practices -See `AGENTS.md` for more detailed instructions and advanced usage. +1. **Use the adapter**: `LangGraphWorkloadAdapter.from_langgraph()` provides comprehensive instrumentation with just a few lines of code +2. **Initialize telemetry early**: Call `initialize_telemetry()` before creating your workloads +3. **Leverage compile_kwargs**: Pass checkpointers and memory configurations through the adapter diff --git a/instrumentation-packages/codon-instrumentation-langgraph/pyproject.toml b/instrumentation-packages/codon-instrumentation-langgraph/pyproject.toml index ffca130..14c3833 100644 --- a/instrumentation-packages/codon-instrumentation-langgraph/pyproject.toml +++ b/instrumentation-packages/codon-instrumentation-langgraph/pyproject.toml @@ -5,11 +5,17 @@ build-backend = "setuptools.build_meta" [project] name = "codon-instrumentation-langgraph" version = "0.1.0a1" -license = "Apache-2.0" +license = {text = "Apache-2.0"} authors = [ + { name="Codon, Inc.", email="martin@codonops.ai" }, { name="Sheldon Gilbert", email="sheldon@codonops.ai"}, { name="Martin Arroyo", email="martin@codonops.ai" }, ] +maintainers = [ + { name="Martin Arroyo", email="martin@codonops.ai" }, + { name="Carl Gordon", email="carl@codonops.ai"}, + { name="Luis Moreno", email="luis@codonops.ai"}, +] description = "Instrumentation package for LangGraph in the Codon ecosystem." readme = "README.md" requires-python = ">=3.9" @@ -19,12 +25,13 @@ classifiers = [ "Operating System :: OS Independent", ] dependencies = [ - "codon_sdk", + "codon-sdk", "opentelemetry-api", "opentelemetry-sdk", "opentelemetry-exporter-otlp-proto-grpc", ] [project.urls] -"Homepage" = "https://github.com/your-username/codon-sdk" -"Bug Tracker" = "https://github.com/your-username/codon-sdk/issues" +"Homepage" = "https://codon-ops.github.io/codon-sdk/instrumentation/langgraph/" +"Bug Tracker" = "https://github.com/Codon-Ops/codon-sdk/issues" +"Documentation" = "https://codon-ops.github.io/codon-sdk/instrumentation/langgraph/"