langgraph-api 0.2.42__py3-none-any.whl → 0.2.43__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of langgraph-api might be problematic. Click here for more details.

langgraph_api/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.2.42"
1
+ __version__ = "0.2.43"
langgraph_api/logging.py CHANGED
@@ -81,23 +81,6 @@ class JSONRenderer:
81
81
  LEVELS = logging.getLevelNamesMapping()
82
82
 
83
83
 
84
- class TapForMetadata:
85
- def __call__(
86
- self, logger: logging.Logger, method_name: str, event_dict: EventDict
87
- ) -> str:
88
- """
89
- Tap WARN and above logs for metadata. Exclude user loggers.
90
- """
91
- if (
92
- event_dict["logger"].startswith("langgraph")
93
- and LEVELS[event_dict["level"].upper()] > LEVELS["INFO"]
94
- ):
95
- from langgraph_api.metadata import append_log
96
-
97
- append_log(event_dict.copy())
98
- return event_dict
99
-
100
-
101
84
  # shared config, for both logging and structlog
102
85
 
103
86
  shared_processors = [
@@ -136,7 +119,6 @@ class Formatter(structlog.stdlib.ProcessorFormatter):
136
119
  super().__init__(
137
120
  processors=[
138
121
  structlog.stdlib.ProcessorFormatter.remove_processors_meta,
139
- TapForMetadata(),
140
122
  renderer,
141
123
  ],
142
124
  foreign_pre_chain=shared_processors,
langgraph_api/metadata.py CHANGED
@@ -35,7 +35,6 @@ else:
35
35
  PLAN = "enterprise" if plus_features_enabled() else "developer"
36
36
  USER_API_URL = os.getenv("LANGGRAPH_API_URL", None)
37
37
 
38
- LOGS: list[dict] = []
39
38
  RUN_COUNTER = 0
40
39
  NODE_COUNTER = 0
41
40
  FROM_TIMESTAMP = datetime.now(UTC).isoformat()
@@ -59,14 +58,6 @@ def incr_nodes(_, *, incr: int = 1) -> None:
59
58
  NODE_COUNTER += incr
60
59
 
61
60
 
62
- def append_log(log: dict) -> None:
63
- if not LANGGRAPH_CLOUD_LICENSE_KEY and not LANGSMITH_API_KEY:
64
- return
65
-
66
- global LOGS
67
- LOGS.append(log)
68
-
69
-
70
61
  async def metadata_loop() -> None:
71
62
  try:
72
63
  from langgraph_api import __version__
@@ -91,8 +82,6 @@ async def metadata_loop() -> None:
91
82
  to_timestamp = datetime.now(UTC).isoformat()
92
83
  nodes = NODE_COUNTER
93
84
  runs = RUN_COUNTER
94
- logs = LOGS.copy()
95
- LOGS.clear()
96
85
  RUN_COUNTER = 0
97
86
  NODE_COUNTER = 0
98
87
  FROM_TIMESTAMP = to_timestamp
@@ -123,7 +112,7 @@ async def metadata_loop() -> None:
123
112
  "langgraph.platform.runs": runs,
124
113
  "langgraph.platform.nodes": nodes,
125
114
  },
126
- "logs": logs,
115
+ "logs": [],
127
116
  }
128
117
  try:
129
118
  await http_request(
langgraph_api/stream.py CHANGED
@@ -207,11 +207,16 @@ async def astream_state(
207
207
  elif "events" in stream_mode:
208
208
  yield "events", event
209
209
  else:
210
+ output_keys = kwargs.pop("output_keys", graph.output_channels)
210
211
  async with (
211
212
  stack,
212
213
  aclosing(
213
214
  graph.astream(
214
- input, config, stream_mode=list(stream_modes_set), **kwargs
215
+ input,
216
+ config,
217
+ stream_mode=list(stream_modes_set),
218
+ output_keys=output_keys,
219
+ **kwargs,
215
220
  )
216
221
  ) as stream,
217
222
  ):
langgraph_api/worker.py CHANGED
@@ -155,13 +155,12 @@ async def worker(
155
155
  )
156
156
 
157
157
  raise RuntimeError(error_message)
158
+ exit_stack = AsyncExitStack()
158
159
  if temporary:
159
- stream = astream_state(
160
- AsyncExitStack(), conn, cast(Run, run), attempt, done
161
- )
160
+ stream = astream_state(exit_stack, conn, cast(Run, run), attempt, done)
162
161
  else:
163
162
  stream = astream_state(
164
- AsyncExitStack(),
163
+ exit_stack,
165
164
  conn,
166
165
  cast(Run, run),
167
166
  attempt,
@@ -216,6 +215,8 @@ async def worker(
216
215
  run_ended_at_dt = datetime.now(UTC)
217
216
  run_ended_at = run_ended_at_dt.isoformat()
218
217
  try:
218
+ # Need to close the pipeline to re-use the connection
219
+ await exit_stack.aclose()
219
220
  await Runs.delete(conn, run_id, thread_id=run["thread_id"])
220
221
  await logger.ainfo(
221
222
  "Background run rolled back",
@@ -240,9 +241,6 @@ async def worker(
240
241
  run_created_at=run_created_at,
241
242
  exc=str(e),
242
243
  )
243
- # We need to clean up the transaction early if we want to
244
- # update the thread status with the same connection
245
- await exit.aclose()
246
244
  except HTTPException as e:
247
245
  if e.status_code == 404:
248
246
  await logger.ainfo(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-api
3
- Version: 0.2.42
3
+ Version: 0.2.43
4
4
  Author-email: Nuno Campos <nuno@langchain.dev>, Will Fu-Hinthorn <will@langchain.dev>
5
5
  License: Elastic-2.0
6
6
  License-File: LICENSE
@@ -1,4 +1,4 @@
1
- langgraph_api/__init__.py,sha256=ZfPaHT9jrZeNvdPfDssvO9QlJXdREiFfpk5CG-mKeQQ,23
1
+ langgraph_api/__init__.py,sha256=-zi4-lvnbxrOY_3QWcNkn-Et6gYFmI1tuUUo7o8nbDs,23
2
2
  langgraph_api/asgi_transport.py,sha256=eqifhHxNnxvI7jJqrY1_8RjL4Fp9NdN4prEub2FWBt8,5091
3
3
  langgraph_api/asyncio.py,sha256=nelZwKL7iOjM5GHj1rVjiPE7igUIKLNKtc-3urxmlfo,9250
4
4
  langgraph_api/cli.py,sha256=9Ou3tGDDY_VVLt5DFle8UviJdpI4ZigC5hElYvq2-To,14519
@@ -8,8 +8,8 @@ langgraph_api/cron_scheduler.py,sha256=i87j4pJrcsmsqMKeKUs69gaAjrGaSM3pM3jnXdN5J
8
8
  langgraph_api/errors.py,sha256=Bu_i5drgNTyJcLiyrwVE_6-XrSU50BHf9TDpttki9wQ,1690
9
9
  langgraph_api/graph.py,sha256=MPm8DvInBQsq2em45c2YD5bW6T_G1LlDkAuWq-19gCQ,23240
10
10
  langgraph_api/http.py,sha256=gYbxxjY8aLnsXeJymcJ7G7Nj_yToOGpPYQqmZ1_ggfA,5240
11
- langgraph_api/logging.py,sha256=VJ-lPwHK6UY2ZcK8LQsYhu7h0zODfVov1laxzyujRcU,4490
12
- langgraph_api/metadata.py,sha256=ptaxwmzdx2bUBSc1KRhqgF-Xnm-Zh2gqwSiHpl8LD9c,4482
11
+ langgraph_api/logging.py,sha256=bx6kxV7O2FUnu0ubrgeJuj5q2EjYC4ve1BkbrVfzy28,3953
12
+ langgraph_api/metadata.py,sha256=2sz9ECnbnQtgqN6ptDkRmymaVKfQPgaX-JuDJDJB47c,4254
13
13
  langgraph_api/patch.py,sha256=Dgs0PXHytekX4SUL6KsjjN0hHcOtGLvv1GRGbh6PswU,1408
14
14
  langgraph_api/queue_entrypoint.py,sha256=_41ZveMDdn9bapjA7Ik9FG3r4hyIwXESUM5F1PdlieE,2309
15
15
  langgraph_api/route.py,sha256=4VBkJMeusfiZtLzyUaKm1HwLHTq0g15y2CRiRhM6xyA,4773
@@ -19,12 +19,12 @@ langgraph_api/server.py,sha256=Z_VL-kIphybTRDWBIqHMfRhgCmAFyTRqAGlgnHQF0Zg,6973
19
19
  langgraph_api/sse.py,sha256=F7swfjKBDrlUmXZ_dWuDVHtp-3o1Cpjq1lwp0bJD-nw,4223
20
20
  langgraph_api/state.py,sha256=8jx4IoTCOjTJuwzuXJKKFwo1VseHjNnw_CCq4x1SW14,2284
21
21
  langgraph_api/store.py,sha256=_xGhdwEIMoY1_hIy_oWwxZp4Y7FH833BNJfgFIhT80E,4640
22
- langgraph_api/stream.py,sha256=T1tkUZFr5KlgqvE-QHEh-m80mWAgp2MUT9gFD7HLen0,12670
22
+ langgraph_api/stream.py,sha256=0qLblAQ406bGZEM1zRQKVyU407c9PjcBcgPCKN78ywc,12847
23
23
  langgraph_api/thread_ttl.py,sha256=-Ox8NFHqUH3wGNdEKMIfAXUubY5WGifIgCaJ7npqLgw,1762
24
24
  langgraph_api/utils.py,sha256=92mSti9GfGdMRRWyESKQW5yV-75Z9icGHnIrBYvdypU,3619
25
25
  langgraph_api/validation.py,sha256=zMuKmwUEBjBgFMwAaeLZmatwGVijKv2sOYtYg7gfRtc,4950
26
26
  langgraph_api/webhook.py,sha256=1ncwO0rIZcj-Df9sxSnFEzd1gP1bfS4okeZQS8NSRoE,1382
27
- langgraph_api/worker.py,sha256=sdUKXr19CSMaptg_3cvzUAy4KOUme1ajwSBt1dvSbsg,14587
27
+ langgraph_api/worker.py,sha256=5YP9e1ABUlxTV1o3ES7fTfdP-SFQRyELwDmHlN3iF8s,14513
28
28
  langgraph_api/api/__init__.py,sha256=YVzpbn5IQotvuuLG9fhS9QMrxXfP4s4EpEMG0n4q3Nw,5625
29
29
  langgraph_api/api/assistants.py,sha256=x_V1rnSGFYjNZFJkZKFN9yNFOqXhqkOSqMDSv3I8VeE,15880
30
30
  langgraph_api/api/mcp.py,sha256=RvRYgANqRzNQzSmgjNkq4RlKTtoEJYil04ot9lsmEtE,14352
@@ -78,8 +78,8 @@ langgraph_runtime/__init__.py,sha256=O4GgSmu33c-Pr8Xzxj_brcK5vkm70iNTcyxEjICFZxA
78
78
  LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
79
79
  logging.json,sha256=3RNjSADZmDq38eHePMm1CbP6qZ71AmpBtLwCmKU9Zgo,379
80
80
  openapi.json,sha256=_4GFDqbq1X9vD4_FxwahuVODJMOHx-U76gkY4rdy3DA,138189
81
- langgraph_api-0.2.42.dist-info/METADATA,sha256=GK8GedSLk6Bg8NPQhNfQAodCid1rz3C4IsQ8a2aEXGk,3892
82
- langgraph_api-0.2.42.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
83
- langgraph_api-0.2.42.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
84
- langgraph_api-0.2.42.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
85
- langgraph_api-0.2.42.dist-info/RECORD,,
81
+ langgraph_api-0.2.43.dist-info/METADATA,sha256=L6NNxxYgiNH0XVWyuywcdbEYAqQuOn0lcQcahG_xbr8,3892
82
+ langgraph_api-0.2.43.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
83
+ langgraph_api-0.2.43.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
84
+ langgraph_api-0.2.43.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
85
+ langgraph_api-0.2.43.dist-info/RECORD,,