langgraph-api 0.4.14__py3-none-any.whl → 0.4.16__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 +1 -1
- langgraph_api/api/a2a.py +11 -33
- langgraph_api/asyncio.py +8 -3
- {langgraph_api-0.4.14.dist-info → langgraph_api-0.4.16.dist-info}/METADATA +1 -1
- {langgraph_api-0.4.14.dist-info → langgraph_api-0.4.16.dist-info}/RECORD +8 -8
- {langgraph_api-0.4.14.dist-info → langgraph_api-0.4.16.dist-info}/WHEEL +0 -0
- {langgraph_api-0.4.14.dist-info → langgraph_api-0.4.16.dist-info}/entry_points.txt +0 -0
- {langgraph_api-0.4.14.dist-info → langgraph_api-0.4.16.dist-info}/licenses/LICENSE +0 -0
langgraph_api/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.4.
|
|
1
|
+
__version__ = "0.4.16"
|
langgraph_api/api/a2a.py
CHANGED
|
@@ -22,6 +22,7 @@ from starlette.responses import JSONResponse, Response
|
|
|
22
22
|
from structlog import getLogger
|
|
23
23
|
from typing_extensions import TypedDict
|
|
24
24
|
|
|
25
|
+
from langgraph_api import __version__
|
|
25
26
|
from langgraph_api.metadata import USER_API_URL
|
|
26
27
|
from langgraph_api.route import ApiRequest, ApiRoute
|
|
27
28
|
from langgraph_api.utils.cache import LRUCache
|
|
@@ -96,28 +97,6 @@ def _client() -> LangGraphClient:
|
|
|
96
97
|
return get_client(url=None)
|
|
97
98
|
|
|
98
99
|
|
|
99
|
-
def _get_version() -> str:
|
|
100
|
-
"""Get langgraph-api version."""
|
|
101
|
-
from langgraph_api import __version__
|
|
102
|
-
|
|
103
|
-
return __version__
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def _generate_task_id() -> str:
|
|
107
|
-
"""Generate a unique task ID."""
|
|
108
|
-
return str(uuid.uuid4())
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
def _generate_context_id() -> str:
|
|
112
|
-
"""Generate a unique context ID."""
|
|
113
|
-
return str(uuid.uuid4())
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
def _generate_timestamp() -> str:
|
|
117
|
-
"""Generate ISO 8601 timestamp."""
|
|
118
|
-
return datetime.now(UTC).isoformat()
|
|
119
|
-
|
|
120
|
-
|
|
121
100
|
async def _get_assistant(
|
|
122
101
|
client: LangGraphClient, assistant_id: str, headers: Headers | dict[str, Any] | None
|
|
123
102
|
) -> dict[str, Any]:
|
|
@@ -469,14 +448,14 @@ def _create_task_response(
|
|
|
469
448
|
"text": f"Error executing assistant: {result['__error__']['error']}",
|
|
470
449
|
}
|
|
471
450
|
],
|
|
472
|
-
"messageId":
|
|
451
|
+
"messageId": str(uuid.uuid4()),
|
|
473
452
|
"taskId": task_id,
|
|
474
453
|
"contextId": context_id,
|
|
475
454
|
"kind": "message",
|
|
476
455
|
},
|
|
477
456
|
}
|
|
478
457
|
else:
|
|
479
|
-
artifact_id =
|
|
458
|
+
artifact_id = str(uuid.uuid4())
|
|
480
459
|
artifacts = [
|
|
481
460
|
{
|
|
482
461
|
"artifactId": artifact_id,
|
|
@@ -493,7 +472,7 @@ def _create_task_response(
|
|
|
493
472
|
|
|
494
473
|
base_task["status"] = {
|
|
495
474
|
"state": "completed",
|
|
496
|
-
"timestamp":
|
|
475
|
+
"timestamp": datetime.now(UTC).isoformat(),
|
|
497
476
|
}
|
|
498
477
|
base_task["artifacts"] = artifacts
|
|
499
478
|
|
|
@@ -749,18 +728,17 @@ async def handle_message_send(
|
|
|
749
728
|
}
|
|
750
729
|
|
|
751
730
|
context_id = message.get("contextId")
|
|
752
|
-
thread_id = context_id if context_id else None
|
|
753
731
|
|
|
754
732
|
try:
|
|
755
|
-
# Creating + joining separately so we can get the run id
|
|
756
733
|
run = await client.runs.create(
|
|
757
|
-
thread_id=
|
|
734
|
+
thread_id=context_id,
|
|
758
735
|
assistant_id=assistant_id,
|
|
759
736
|
input=input_content,
|
|
737
|
+
if_not_exists="create",
|
|
760
738
|
headers=request.headers,
|
|
761
739
|
)
|
|
762
740
|
except Exception as e:
|
|
763
|
-
error_response = _map_runs_create_error_to_rpc(e, assistant_id,
|
|
741
|
+
error_response = _map_runs_create_error_to_rpc(e, assistant_id, context_id)
|
|
764
742
|
if error_response.get("error", {}).get("code") == ERROR_CODE_INTERNAL_ERROR:
|
|
765
743
|
raise
|
|
766
744
|
return error_response
|
|
@@ -772,7 +750,7 @@ async def handle_message_send(
|
|
|
772
750
|
)
|
|
773
751
|
|
|
774
752
|
task_id = run["run_id"]
|
|
775
|
-
context_id = thread_id
|
|
753
|
+
context_id = run["thread_id"]
|
|
776
754
|
|
|
777
755
|
return _create_task_response(
|
|
778
756
|
task_id=task_id,
|
|
@@ -884,7 +862,7 @@ async def handle_tasks_get(
|
|
|
884
862
|
task_response["status"]["message"] = {
|
|
885
863
|
"role": "agent",
|
|
886
864
|
"parts": [{"kind": "text", "text": "Task completed successfully"}],
|
|
887
|
-
"messageId":
|
|
865
|
+
"messageId": str(uuid.uuid4()),
|
|
888
866
|
"taskId": task_id,
|
|
889
867
|
}
|
|
890
868
|
elif a2a_state == "failed":
|
|
@@ -893,7 +871,7 @@ async def handle_tasks_get(
|
|
|
893
871
|
"parts": [
|
|
894
872
|
{"kind": "text", "text": f"Task failed with status: {lg_status}"}
|
|
895
873
|
],
|
|
896
|
-
"messageId":
|
|
874
|
+
"messageId": str(uuid.uuid4()),
|
|
897
875
|
"taskId": task_id,
|
|
898
876
|
}
|
|
899
877
|
|
|
@@ -1021,7 +999,7 @@ async def generate_agent_card(request: ApiRequest, assistant_id: str) -> dict[st
|
|
|
1021
999
|
"defaultInputModes": ["application/json", "text/plain"],
|
|
1022
1000
|
"defaultOutputModes": ["application/json", "text/plain"],
|
|
1023
1001
|
"skills": skills,
|
|
1024
|
-
"version":
|
|
1002
|
+
"version": __version__,
|
|
1025
1003
|
}
|
|
1026
1004
|
|
|
1027
1005
|
|
langgraph_api/asyncio.py
CHANGED
|
@@ -115,11 +115,16 @@ def create_task(
|
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
def run_coroutine_threadsafe(
|
|
118
|
-
coro: Coroutine[Any, Any, T],
|
|
118
|
+
coro: Coroutine[Any, Any, T],
|
|
119
|
+
ignore_exceptions: tuple[type[Exception], ...] = (),
|
|
120
|
+
*,
|
|
121
|
+
loop: asyncio.AbstractEventLoop | None = None,
|
|
119
122
|
) -> concurrent.futures.Future[T] | concurrent.futures.Future[None]:
|
|
120
|
-
if
|
|
123
|
+
if loop is None:
|
|
124
|
+
loop = _MAIN_LOOP
|
|
125
|
+
if loop is None:
|
|
121
126
|
raise RuntimeError("No event loop set")
|
|
122
|
-
future = asyncio.run_coroutine_threadsafe(coro,
|
|
127
|
+
future = asyncio.run_coroutine_threadsafe(coro, loop)
|
|
123
128
|
future.add_done_callback(partial(_create_task_done_callback, ignore_exceptions))
|
|
124
129
|
return future
|
|
125
130
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
langgraph_api/__init__.py,sha256=
|
|
1
|
+
langgraph_api/__init__.py,sha256=Qgm7I6hoEastyorRf_J_YW-gsesKcI737L731iY3jes,23
|
|
2
2
|
langgraph_api/asgi_transport.py,sha256=XtiLOu4WWsd-xizagBLzT5xUkxc9ZG9YqwvETBPjBFE,5161
|
|
3
|
-
langgraph_api/asyncio.py,sha256=
|
|
3
|
+
langgraph_api/asyncio.py,sha256=FEEkLm_N-15cbElo4vQ309MkDKBZuRqAYV8VJ1DocNw,9860
|
|
4
4
|
langgraph_api/cli.py,sha256=-ruIeKi1imvS6GriOfRDZY-waV4SbWiJ0BEFAciPVYI,16330
|
|
5
5
|
langgraph_api/command.py,sha256=Q9XDRhnkCX7jyqW52_Rf2PPYKxjr-Z9BUHazI1HcmB8,817
|
|
6
6
|
langgraph_api/config.py,sha256=r9mmbyZlhBuJLpnTkaOLcNH6ufFNqm_2eCiuOmhqRl0,12241
|
|
@@ -29,7 +29,7 @@ langgraph_api/validation.py,sha256=86jftgOsMa7tkeshBw6imYe7zyUXPoVuf5Voh6dFiR8,5
|
|
|
29
29
|
langgraph_api/webhook.py,sha256=SvSM1rdnNtiH4q3JQYmAqJUk2Sable5xAcwOLuRhtlo,1723
|
|
30
30
|
langgraph_api/worker.py,sha256=FQRw3kL9ynDv_LNgY_OjjPZQBuAvSQpsW6nECnABvDg,15354
|
|
31
31
|
langgraph_api/api/__init__.py,sha256=raFkYH50tsO-KjRmDbGVoHCuxuH58u1lrZbr-MlITIY,6262
|
|
32
|
-
langgraph_api/api/a2a.py,sha256=
|
|
32
|
+
langgraph_api/api/a2a.py,sha256=ChqlhgTq5fzWt0jbbEl8ec9rf-cvAP19Yge7OFv8-6E,34629
|
|
33
33
|
langgraph_api/api/assistants.py,sha256=JFaBYp9BAXGaJ0yfy1SG_Mr-3xjeWSkdCHtmXpiAqP4,17290
|
|
34
34
|
langgraph_api/api/mcp.py,sha256=qe10ZRMN3f-Hli-9TI8nbQyWvMeBb72YB1PZVbyqBQw,14418
|
|
35
35
|
langgraph_api/api/meta.py,sha256=Qyj6r5czkVJ81tpD6liFY7tlrmFDsiSfBr-4X8HJpRc,4834
|
|
@@ -98,8 +98,8 @@ langgraph_runtime/store.py,sha256=7mowndlsIroGHv3NpTSOZDJR0lCuaYMBoTnTrewjslw,11
|
|
|
98
98
|
LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
|
|
99
99
|
logging.json,sha256=3RNjSADZmDq38eHePMm1CbP6qZ71AmpBtLwCmKU9Zgo,379
|
|
100
100
|
openapi.json,sha256=21wu-NxdxyTQwZctNcEfRkLMnSBi0QhGAfwq5kg8XNU,172618
|
|
101
|
-
langgraph_api-0.4.
|
|
102
|
-
langgraph_api-0.4.
|
|
103
|
-
langgraph_api-0.4.
|
|
104
|
-
langgraph_api-0.4.
|
|
105
|
-
langgraph_api-0.4.
|
|
101
|
+
langgraph_api-0.4.16.dist-info/METADATA,sha256=kvxtObVWl9I5JefxVXy9SET3EF03Zf9w-rITM-UIWRc,3893
|
|
102
|
+
langgraph_api-0.4.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
103
|
+
langgraph_api-0.4.16.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
|
|
104
|
+
langgraph_api-0.4.16.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
|
|
105
|
+
langgraph_api-0.4.16.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|