cortexhub 0.1.4__py3-none-any.whl → 0.1.5__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.
- cortexhub/adapters/claude_agents.py +12 -1
- {cortexhub-0.1.4.dist-info → cortexhub-0.1.5.dist-info}/METADATA +1 -1
- {cortexhub-0.1.4.dist-info → cortexhub-0.1.5.dist-info}/RECORD +5 -5
- {cortexhub-0.1.4.dist-info → cortexhub-0.1.5.dist-info}/WHEEL +0 -0
- {cortexhub-0.1.4.dist-info → cortexhub-0.1.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -73,6 +73,7 @@ class ClaudeAgentsAdapter(ToolAdapter):
|
|
|
73
73
|
def __init__(self, cortex_hub: Any):
|
|
74
74
|
super().__init__(cortex_hub)
|
|
75
75
|
self._hook_spans: dict[str, Any] = {}
|
|
76
|
+
self._active_run_session_id: str | None = None
|
|
76
77
|
|
|
77
78
|
def _get_framework_modules(self) -> list[str]:
|
|
78
79
|
return ["claude_agent_sdk"]
|
|
@@ -206,6 +207,7 @@ class ClaudeAgentsAdapter(ToolAdapter):
|
|
|
206
207
|
try:
|
|
207
208
|
import claude_agent_sdk
|
|
208
209
|
from claude_agent_sdk import ClaudeSDKClient, ResultMessage
|
|
210
|
+
adapter = self
|
|
209
211
|
|
|
210
212
|
if getattr(claude_agent_sdk, _PATCHED_RUN_ATTR, False):
|
|
211
213
|
return
|
|
@@ -218,6 +220,7 @@ class ClaudeAgentsAdapter(ToolAdapter):
|
|
|
218
220
|
status = None
|
|
219
221
|
failed = False
|
|
220
222
|
cortex_hub.start_run(framework="claude_agents")
|
|
223
|
+
adapter._active_run_session_id = cortex_hub.session_id
|
|
221
224
|
try:
|
|
222
225
|
async for message in original_query(*args, **kwargs):
|
|
223
226
|
if isinstance(message, ResultMessage):
|
|
@@ -231,6 +234,7 @@ class ClaudeAgentsAdapter(ToolAdapter):
|
|
|
231
234
|
status = "failed"
|
|
232
235
|
if status:
|
|
233
236
|
cortex_hub.finish_run(framework="claude_agents", status=status)
|
|
237
|
+
adapter._active_run_session_id = None
|
|
234
238
|
|
|
235
239
|
claude_agent_sdk.query = patched_query
|
|
236
240
|
|
|
@@ -251,10 +255,12 @@ class ClaudeAgentsAdapter(ToolAdapter):
|
|
|
251
255
|
|
|
252
256
|
async def patched_client_query(self, *args, **kwargs):
|
|
253
257
|
cortex_hub.start_run(framework="claude_agents")
|
|
258
|
+
adapter._active_run_session_id = cortex_hub.session_id
|
|
254
259
|
try:
|
|
255
260
|
return await original_client_query(self, *args, **kwargs)
|
|
256
261
|
except Exception:
|
|
257
262
|
cortex_hub.finish_run(framework="claude_agents", status="failed")
|
|
263
|
+
adapter._active_run_session_id = None
|
|
258
264
|
raise
|
|
259
265
|
|
|
260
266
|
async def patched_receive_response(self, *args, **kwargs):
|
|
@@ -273,6 +279,7 @@ class ClaudeAgentsAdapter(ToolAdapter):
|
|
|
273
279
|
status = "failed"
|
|
274
280
|
if status:
|
|
275
281
|
cortex_hub.finish_run(framework="claude_agents", status=status)
|
|
282
|
+
adapter._active_run_session_id = None
|
|
276
283
|
|
|
277
284
|
ClaudeSDKClient.query = patched_client_query
|
|
278
285
|
ClaudeSDKClient.receive_response = patched_receive_response
|
|
@@ -303,6 +310,10 @@ class ClaudeAgentsAdapter(ToolAdapter):
|
|
|
303
310
|
"""
|
|
304
311
|
cortex_hub = self.cortex_hub
|
|
305
312
|
span_store = self._hook_spans
|
|
313
|
+
adapter = self
|
|
314
|
+
|
|
315
|
+
def _current_session_id() -> str:
|
|
316
|
+
return adapter._active_run_session_id or cortex_hub.session_id
|
|
306
317
|
|
|
307
318
|
def _start_tool_span(
|
|
308
319
|
*,
|
|
@@ -316,7 +327,7 @@ class ClaudeAgentsAdapter(ToolAdapter):
|
|
|
316
327
|
name="tool.invoke",
|
|
317
328
|
kind=SpanKind.INTERNAL,
|
|
318
329
|
)
|
|
319
|
-
span.set_attribute("cortexhub.session.id",
|
|
330
|
+
span.set_attribute("cortexhub.session.id", _current_session_id())
|
|
320
331
|
span.set_attribute("cortexhub.agent.id", cortex_hub.agent_id)
|
|
321
332
|
span.set_attribute("cortexhub.tool.name", tool_name)
|
|
322
333
|
span.set_attribute("cortexhub.tool.framework", "claude_agents")
|
|
@@ -8,7 +8,7 @@ cortexhub/pipeline.py,sha256=EvkrEz7dGnzc0tlv02B3Kx2KQfdX4gsTuhUxj-MwuFI,3256
|
|
|
8
8
|
cortexhub/version.py,sha256=L1gsFyWfMZYvly7nYjyH0nlWRAsm65S61_B-imDPgXE,68
|
|
9
9
|
cortexhub/adapters/__init__.py,sha256=Lb6RquGPGs4exdfSB6Qb6q6HyGczozuLWSaLCtgZdyo,130
|
|
10
10
|
cortexhub/adapters/base.py,sha256=_ODoJFLQLYnowse3MHQk8bN9KjE1oQr8QDNNlvPSwSs,4094
|
|
11
|
-
cortexhub/adapters/claude_agents.py,sha256=
|
|
11
|
+
cortexhub/adapters/claude_agents.py,sha256=RzFxMCylL3yCgnTASKnpa5F60t0RD-IrvoDfpRKYPFY,23038
|
|
12
12
|
cortexhub/adapters/crewai.py,sha256=SuyMBF9bzrqDq58ZsGZV-3uAzaAtlLD3xEeyMB2Hgig,24899
|
|
13
13
|
cortexhub/adapters/langgraph.py,sha256=X0UutdATOowXcZYRv_ImiJGSO97MKgYcuxFKV-jTxJA,20850
|
|
14
14
|
cortexhub/adapters/openai_agents.py,sha256=63rNZ8HItZdoxERk1BTYzzpVe8Qq_8j56jfrEICzjpU,21511
|
|
@@ -33,7 +33,7 @@ cortexhub/policy/models.py,sha256=81NPX36yru0AZ22Wivytv3uxlwir4VsTN4MZgq4bdiA,38
|
|
|
33
33
|
cortexhub/policy/sync.py,sha256=7kAc3rd5WftipR8XKwvU8SwukIoY-0gcGW2fsf-ij_I,5999
|
|
34
34
|
cortexhub/telemetry/__init__.py,sha256=RSY38hHnYtbRURLoWAhbYYxYMtCItVYZBNN6Bfny8uA,1049
|
|
35
35
|
cortexhub/telemetry/otel.py,sha256=T2pC-K_S_KmrLvfcd3oHMbEwC5ibGZ-PXTZSY0xJgcQ,16633
|
|
36
|
-
cortexhub-0.1.
|
|
37
|
-
cortexhub-0.1.
|
|
38
|
-
cortexhub-0.1.
|
|
39
|
-
cortexhub-0.1.
|
|
36
|
+
cortexhub-0.1.5.dist-info/METADATA,sha256=oZPJ9gFAkIQ6D7jYLElFa9gobzaz3yyqqTGgsMRb7MM,8539
|
|
37
|
+
cortexhub-0.1.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
38
|
+
cortexhub-0.1.5.dist-info/licenses/LICENSE,sha256=R-lPsEVN69q2o19ge2_O9Vt9cJuGM557oEYX3XdnvIk,1066
|
|
39
|
+
cortexhub-0.1.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|