kalibr 1.2.1__tar.gz → 1.2.2__tar.gz

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.
Files changed (57) hide show
  1. {kalibr-1.2.1 → kalibr-1.2.2}/PKG-INFO +2 -3
  2. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr.egg-info/PKG-INFO +2 -3
  3. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr_crewai/instrumentor.py +68 -19
  4. {kalibr-1.2.1 → kalibr-1.2.2}/pyproject.toml +2 -2
  5. {kalibr-1.2.1 → kalibr-1.2.2}/LICENSE +0 -0
  6. {kalibr-1.2.1 → kalibr-1.2.2}/README.md +0 -0
  7. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/__init__.py +0 -0
  8. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/__main__.py +0 -0
  9. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/capsule_middleware.py +0 -0
  10. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/cli/__init__.py +0 -0
  11. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/cli/capsule_cmd.py +0 -0
  12. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/cli/deploy_cmd.py +0 -0
  13. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/cli/main.py +0 -0
  14. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/cli/run.py +0 -0
  15. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/cli/serve.py +0 -0
  16. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/client.py +0 -0
  17. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/collector.py +0 -0
  18. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/context.py +0 -0
  19. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/cost_adapter.py +0 -0
  20. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/decorators.py +0 -0
  21. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/instrumentation/__init__.py +0 -0
  22. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/instrumentation/anthropic_instr.py +0 -0
  23. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/instrumentation/base.py +0 -0
  24. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/instrumentation/google_instr.py +0 -0
  25. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/instrumentation/openai_instr.py +0 -0
  26. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/instrumentation/registry.py +0 -0
  27. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/intelligence.py +0 -0
  28. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/kalibr.py +0 -0
  29. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/kalibr_app.py +0 -0
  30. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/middleware/__init__.py +0 -0
  31. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/middleware/auto_tracer.py +0 -0
  32. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/models.py +0 -0
  33. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/redaction.py +0 -0
  34. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/schemas.py +0 -0
  35. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/simple_tracer.py +0 -0
  36. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/tokens.py +0 -0
  37. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/trace_capsule.py +0 -0
  38. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/trace_models.py +0 -0
  39. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/tracer.py +0 -0
  40. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/types.py +0 -0
  41. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr/utils.py +0 -0
  42. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr.egg-info/SOURCES.txt +0 -0
  43. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr.egg-info/dependency_links.txt +0 -0
  44. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr.egg-info/entry_points.txt +0 -0
  45. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr.egg-info/requires.txt +0 -0
  46. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr.egg-info/top_level.txt +0 -0
  47. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr_crewai/__init__.py +0 -0
  48. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr_crewai/callbacks.py +0 -0
  49. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr_langchain/__init__.py +0 -0
  50. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr_langchain/async_callback.py +0 -0
  51. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr_langchain/callback.py +0 -0
  52. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr_openai_agents/__init__.py +0 -0
  53. {kalibr-1.2.1 → kalibr-1.2.2}/kalibr_openai_agents/processor.py +0 -0
  54. {kalibr-1.2.1 → kalibr-1.2.2}/setup.cfg +0 -0
  55. {kalibr-1.2.1 → kalibr-1.2.2}/tests/test_capsule_builder.py +0 -0
  56. {kalibr-1.2.1 → kalibr-1.2.2}/tests/test_instrumentation.py +0 -0
  57. {kalibr-1.2.1 → kalibr-1.2.2}/tests/test_intelligence.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.2
2
2
  Name: kalibr
3
- Version: 1.2.1
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
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.2
2
2
  Name: kalibr
3
- Version: 1.2.1
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
 
@@ -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
- agent_count = len(getattr(crew_self, "agents", []))
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
- # Create event
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": "crewai",
277
- "model_id": "crew",
278
- "model_name": crew_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": 0,
284
- "output_tokens": 0,
285
- "total_tokens": 0,
286
- "cost_usd": 0.0,
287
- "total_cost_usd": 0.0,
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
- agent_count = len(getattr(crew_self, "agents", []))
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": "crewai",
359
- "model_id": "crew",
360
- "model_name": crew_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": 0,
366
- "output_tokens": 0,
367
- "total_tokens": 0,
368
- "cost_usd": 0.0,
369
- "total_cost_usd": 0.0,
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()),
@@ -1,10 +1,10 @@
1
1
  [build-system]
2
- requires = ["setuptools>=61.0", "wheel"]
2
+ requires = ["setuptools>=61.0,<77", "wheel"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "kalibr"
7
- version = "1.2.1"
7
+ version = "1.2.2"
8
8
  description = "Unified LLM Observability & Multi-Model AI Integration Framework - Deploy to GPT, Claude, Gemini, Copilot with full telemetry."
9
9
  authors = [{name = "Kalibr Team", email = "support@kalibr.systems"}]
10
10
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes