kalibr 1.2.1__py3-none-any.whl → 1.2.2__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.
- {kalibr-1.2.1.dist-info → kalibr-1.2.2.dist-info}/METADATA +2 -3
- {kalibr-1.2.1.dist-info → kalibr-1.2.2.dist-info}/RECORD +7 -7
- {kalibr-1.2.1.dist-info → kalibr-1.2.2.dist-info}/WHEEL +1 -1
- kalibr_crewai/instrumentor.py +68 -19
- {kalibr-1.2.1.dist-info/licenses → kalibr-1.2.2.dist-info}/LICENSE +0 -0
- {kalibr-1.2.1.dist-info → kalibr-1.2.2.dist-info}/entry_points.txt +0 -0
- {kalibr-1.2.1.dist-info → kalibr-1.2.2.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: kalibr
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: Unified LLM Observability & Multi-Model AI Integration Framework - Deploy to GPT, Claude, Gemini, Copilot with full telemetry.
|
|
5
5
|
Author-email: Kalibr Team <support@kalibr.systems>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -64,7 +64,6 @@ Requires-Dist: pytest>=7.4.0; extra == "dev"
|
|
|
64
64
|
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
65
65
|
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
66
66
|
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
67
|
-
Dynamic: license-file
|
|
68
67
|
|
|
69
68
|
# Kalibr Python SDK
|
|
70
69
|
|
|
@@ -33,17 +33,17 @@ kalibr/instrumentation/openai_instr.py,sha256=UU0Pi1Gq1FqgetYWDacQhNFdjemuPrc0hR
|
|
|
33
33
|
kalibr/instrumentation/registry.py,sha256=sfQnXhbPOI5LVon2kFhe8KcXQwWmuKW1XUe50B2AaBc,4749
|
|
34
34
|
kalibr/middleware/__init__.py,sha256=qyDUn_irAX67MS-IkuDVxg4RmFnJHDf_BfIT3qfGoBI,115
|
|
35
35
|
kalibr/middleware/auto_tracer.py,sha256=ZBSBM0O3a6rwVzfik1n5NUmQDah8_iaf86rU64aPYT4,13037
|
|
36
|
-
kalibr-1.2.1.dist-info/licenses/LICENSE,sha256=5mwAnB38l3_PjmOQn6_L6cZnJvus143DUjMBPIH1yso,10768
|
|
37
36
|
kalibr_crewai/__init__.py,sha256=b0HFTiE80eArtSMBOIEKu1JM6KU0tCjEylKCVVVF29Q,1796
|
|
38
37
|
kalibr_crewai/callbacks.py,sha256=_d1M4J-6XfKqrVIxnOgOQu57jpFKVv-VIsmPV0HNgZ4,20419
|
|
39
|
-
kalibr_crewai/instrumentor.py,sha256=
|
|
38
|
+
kalibr_crewai/instrumentor.py,sha256=x26v0RcriImkPiC8KB1Hmez1XOYLcDa9o-g35BMu5Ek,24420
|
|
40
39
|
kalibr_langchain/__init__.py,sha256=O4XYVyhLp1v-Y1kGZw3zD-tUK9wp0UX8Jt6oN0QTHN4,1373
|
|
41
40
|
kalibr_langchain/async_callback.py,sha256=_Mj_YrKbULNtfxixZ7iwiHyWEV9l178ZA5Oy5A5Pakk,27748
|
|
42
41
|
kalibr_langchain/callback.py,sha256=SNM1aHOXdG55grHmGyTwbXOeM6hjZTub2REiZD2H-d8,35216
|
|
43
42
|
kalibr_openai_agents/__init__.py,sha256=wL59LzGstptKigfQDrKKt_7hcMO1JGVQtVAsE0lz-Zw,1367
|
|
44
43
|
kalibr_openai_agents/processor.py,sha256=F550sdRf3rpguP1yOlgAUQWDLPBy4hSACV3-zOyCpOU,18257
|
|
45
|
-
kalibr-1.2.
|
|
46
|
-
kalibr-1.2.
|
|
47
|
-
kalibr-1.2.
|
|
48
|
-
kalibr-1.2.
|
|
49
|
-
kalibr-1.2.
|
|
44
|
+
kalibr-1.2.2.dist-info/LICENSE,sha256=5mwAnB38l3_PjmOQn6_L6cZnJvus143DUjMBPIH1yso,10768
|
|
45
|
+
kalibr-1.2.2.dist-info/METADATA,sha256=XqhSOZekE5D5WQVT0pH2h1HCZWXiruGM9CqOelAZnf0,11201
|
|
46
|
+
kalibr-1.2.2.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
|
|
47
|
+
kalibr-1.2.2.dist-info/entry_points.txt,sha256=Kojlc6WRX8V1qS9lOMdDPZpTUVHCtzGtHqXusErgmLY,47
|
|
48
|
+
kalibr-1.2.2.dist-info/top_level.txt,sha256=dIfBOWUnnHGFDwgz5zfIx5_0bU3wOUgAbYr4JcFHZmo,59
|
|
49
|
+
kalibr-1.2.2.dist-info/RECORD,,
|
kalibr_crewai/instrumentor.py
CHANGED
|
@@ -150,6 +150,10 @@ class KalibrCrewAIInstrumentor:
|
|
|
150
150
|
# Instrumentation state
|
|
151
151
|
self._is_instrumented = False
|
|
152
152
|
|
|
153
|
+
# Accumulated metrics for crew-level aggregation
|
|
154
|
+
self._accumulated_tokens = {"input": 0, "output": 0}
|
|
155
|
+
self._accumulated_cost = 0.0
|
|
156
|
+
|
|
153
157
|
def instrument(self) -> bool:
|
|
154
158
|
"""Instrument CrewAI classes.
|
|
155
159
|
|
|
@@ -236,11 +240,22 @@ class KalibrCrewAIInstrumentor:
|
|
|
236
240
|
start_time = time.time()
|
|
237
241
|
ts_start = datetime.now(timezone.utc)
|
|
238
242
|
|
|
243
|
+
# Reset accumulators before crew execution
|
|
244
|
+
instrumentor._accumulated_tokens = {"input": 0, "output": 0}
|
|
245
|
+
instrumentor._accumulated_cost = 0.0
|
|
246
|
+
|
|
239
247
|
# Capture crew info
|
|
240
248
|
crew_name = getattr(crew_self, "name", None) or "unnamed_crew"
|
|
241
|
-
|
|
249
|
+
agents = getattr(crew_self, "agents", [])
|
|
250
|
+
agent_count = len(agents)
|
|
242
251
|
task_count = len(getattr(crew_self, "tasks", []))
|
|
243
252
|
|
|
253
|
+
# Extract model from first agent if available
|
|
254
|
+
model_name = "unknown"
|
|
255
|
+
provider = "crewai"
|
|
256
|
+
if agents:
|
|
257
|
+
model_name, provider = _extract_model_from_agent(agents[0])
|
|
258
|
+
|
|
244
259
|
status = "success"
|
|
245
260
|
error_type = None
|
|
246
261
|
error_message = None
|
|
@@ -265,7 +280,13 @@ class KalibrCrewAIInstrumentor:
|
|
|
265
280
|
if instrumentor.capture_output and result is not None:
|
|
266
281
|
output_preview = str(result)[:500]
|
|
267
282
|
|
|
268
|
-
#
|
|
283
|
+
# Get accumulated metrics from child agent/task executions
|
|
284
|
+
input_tokens = instrumentor._accumulated_tokens["input"]
|
|
285
|
+
output_tokens = instrumentor._accumulated_tokens["output"]
|
|
286
|
+
total_tokens = input_tokens + output_tokens
|
|
287
|
+
cost_usd = instrumentor._accumulated_cost
|
|
288
|
+
|
|
289
|
+
# Create event with aggregated metrics
|
|
269
290
|
event = {
|
|
270
291
|
"schema_version": "1.0",
|
|
271
292
|
"trace_id": trace_id,
|
|
@@ -273,18 +294,18 @@ class KalibrCrewAIInstrumentor:
|
|
|
273
294
|
"parent_span_id": None,
|
|
274
295
|
"tenant_id": instrumentor.tenant_id,
|
|
275
296
|
"workflow_id": instrumentor.workflow_id,
|
|
276
|
-
"provider":
|
|
277
|
-
"model_id":
|
|
278
|
-
"model_name":
|
|
297
|
+
"provider": provider,
|
|
298
|
+
"model_id": model_name,
|
|
299
|
+
"model_name": model_name,
|
|
279
300
|
"operation": f"crew:{crew_name}",
|
|
280
301
|
"endpoint": "crew.kickoff",
|
|
281
302
|
"duration_ms": duration_ms,
|
|
282
303
|
"latency_ms": duration_ms,
|
|
283
|
-
"input_tokens":
|
|
284
|
-
"output_tokens":
|
|
285
|
-
"total_tokens":
|
|
286
|
-
"cost_usd":
|
|
287
|
-
"total_cost_usd":
|
|
304
|
+
"input_tokens": input_tokens,
|
|
305
|
+
"output_tokens": output_tokens,
|
|
306
|
+
"total_tokens": total_tokens,
|
|
307
|
+
"cost_usd": cost_usd,
|
|
308
|
+
"total_cost_usd": cost_usd,
|
|
288
309
|
"status": status,
|
|
289
310
|
"error_type": error_type,
|
|
290
311
|
"error_message": error_message,
|
|
@@ -321,10 +342,21 @@ class KalibrCrewAIInstrumentor:
|
|
|
321
342
|
start_time = time.time()
|
|
322
343
|
ts_start = datetime.now(timezone.utc)
|
|
323
344
|
|
|
345
|
+
# Reset accumulators before crew execution
|
|
346
|
+
instrumentor._accumulated_tokens = {"input": 0, "output": 0}
|
|
347
|
+
instrumentor._accumulated_cost = 0.0
|
|
348
|
+
|
|
324
349
|
crew_name = getattr(crew_self, "name", None) or "unnamed_crew"
|
|
325
|
-
|
|
350
|
+
agents = getattr(crew_self, "agents", [])
|
|
351
|
+
agent_count = len(agents)
|
|
326
352
|
task_count = len(getattr(crew_self, "tasks", []))
|
|
327
353
|
|
|
354
|
+
# Extract model from first agent if available
|
|
355
|
+
model_name = "unknown"
|
|
356
|
+
provider = "crewai"
|
|
357
|
+
if agents:
|
|
358
|
+
model_name, provider = _extract_model_from_agent(agents[0])
|
|
359
|
+
|
|
328
360
|
status = "success"
|
|
329
361
|
error_type = None
|
|
330
362
|
error_message = None
|
|
@@ -348,6 +380,13 @@ class KalibrCrewAIInstrumentor:
|
|
|
348
380
|
if instrumentor.capture_output and result is not None:
|
|
349
381
|
output_preview = str(result)[:500]
|
|
350
382
|
|
|
383
|
+
# Get accumulated metrics from child agent/task executions
|
|
384
|
+
input_tokens = instrumentor._accumulated_tokens["input"]
|
|
385
|
+
output_tokens = instrumentor._accumulated_tokens["output"]
|
|
386
|
+
total_tokens = input_tokens + output_tokens
|
|
387
|
+
cost_usd = instrumentor._accumulated_cost
|
|
388
|
+
|
|
389
|
+
# Create event with aggregated metrics
|
|
351
390
|
event = {
|
|
352
391
|
"schema_version": "1.0",
|
|
353
392
|
"trace_id": trace_id,
|
|
@@ -355,18 +394,18 @@ class KalibrCrewAIInstrumentor:
|
|
|
355
394
|
"parent_span_id": None,
|
|
356
395
|
"tenant_id": instrumentor.tenant_id,
|
|
357
396
|
"workflow_id": instrumentor.workflow_id,
|
|
358
|
-
"provider":
|
|
359
|
-
"model_id":
|
|
360
|
-
"model_name":
|
|
397
|
+
"provider": provider,
|
|
398
|
+
"model_id": model_name,
|
|
399
|
+
"model_name": model_name,
|
|
361
400
|
"operation": f"crew:{crew_name}",
|
|
362
401
|
"endpoint": "crew.kickoff_async",
|
|
363
402
|
"duration_ms": duration_ms,
|
|
364
403
|
"latency_ms": duration_ms,
|
|
365
|
-
"input_tokens":
|
|
366
|
-
"output_tokens":
|
|
367
|
-
"total_tokens":
|
|
368
|
-
"cost_usd":
|
|
369
|
-
"total_cost_usd":
|
|
404
|
+
"input_tokens": input_tokens,
|
|
405
|
+
"output_tokens": output_tokens,
|
|
406
|
+
"total_tokens": total_tokens,
|
|
407
|
+
"cost_usd": cost_usd,
|
|
408
|
+
"total_cost_usd": cost_usd,
|
|
370
409
|
"status": status,
|
|
371
410
|
"error_type": error_type,
|
|
372
411
|
"error_message": error_message,
|
|
@@ -445,6 +484,11 @@ class KalibrCrewAIInstrumentor:
|
|
|
445
484
|
# Calculate cost using CostAdapterFactory
|
|
446
485
|
cost_usd = _calculate_cost(provider, model_name, input_tokens, output_tokens)
|
|
447
486
|
|
|
487
|
+
# Accumulate metrics for crew-level aggregation
|
|
488
|
+
instrumentor._accumulated_tokens["input"] += input_tokens
|
|
489
|
+
instrumentor._accumulated_tokens["output"] += output_tokens
|
|
490
|
+
instrumentor._accumulated_cost += cost_usd
|
|
491
|
+
|
|
448
492
|
event = {
|
|
449
493
|
"schema_version": "1.0",
|
|
450
494
|
"trace_id": str(uuid.uuid4()), # TODO: Link to crew trace
|
|
@@ -541,6 +585,11 @@ class KalibrCrewAIInstrumentor:
|
|
|
541
585
|
# Calculate cost using CostAdapterFactory
|
|
542
586
|
cost_usd = _calculate_cost(provider, model_name, input_tokens, output_tokens)
|
|
543
587
|
|
|
588
|
+
# Accumulate metrics for crew-level aggregation
|
|
589
|
+
instrumentor._accumulated_tokens["input"] += input_tokens
|
|
590
|
+
instrumentor._accumulated_tokens["output"] += output_tokens
|
|
591
|
+
instrumentor._accumulated_cost += cost_usd
|
|
592
|
+
|
|
544
593
|
event = {
|
|
545
594
|
"schema_version": "1.0",
|
|
546
595
|
"trace_id": str(uuid.uuid4()),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|