kalibr 1.1.1a0__tar.gz → 1.1.3a0__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 (60) hide show
  1. kalibr-1.1.3a0/PKG-INFO +236 -0
  2. kalibr-1.1.3a0/README.md +168 -0
  3. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/__init__.py +9 -51
  4. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/cli/capsule_cmd.py +2 -2
  5. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/cli/run.py +5 -2
  6. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/client.py +1 -1
  7. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/middleware/auto_tracer.py +1 -1
  8. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/simple_tracer.py +6 -3
  9. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/utils.py +2 -2
  10. kalibr-1.1.3a0/kalibr.egg-info/PKG-INFO +236 -0
  11. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr.egg-info/SOURCES.txt +8 -0
  12. kalibr-1.1.3a0/kalibr.egg-info/requires.txt +50 -0
  13. kalibr-1.1.3a0/kalibr.egg-info/top_level.txt +4 -0
  14. kalibr-1.1.3a0/kalibr_crewai/__init__.py +65 -0
  15. kalibr-1.1.3a0/kalibr_crewai/callbacks.py +539 -0
  16. kalibr-1.1.3a0/kalibr_crewai/instrumentor.py +513 -0
  17. kalibr-1.1.3a0/kalibr_langchain/__init__.py +47 -0
  18. kalibr-1.1.3a0/kalibr_langchain/async_callback.py +850 -0
  19. kalibr-1.1.3a0/kalibr_langchain/callback.py +1064 -0
  20. kalibr-1.1.3a0/kalibr_openai_agents/__init__.py +43 -0
  21. kalibr-1.1.3a0/kalibr_openai_agents/processor.py +554 -0
  22. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/pyproject.toml +46 -8
  23. kalibr-1.1.1a0/PKG-INFO +0 -97
  24. kalibr-1.1.1a0/README.md +0 -54
  25. kalibr-1.1.1a0/kalibr.egg-info/PKG-INFO +0 -97
  26. kalibr-1.1.1a0/kalibr.egg-info/requires.txt +0 -17
  27. kalibr-1.1.1a0/kalibr.egg-info/top_level.txt +0 -1
  28. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/LICENSE +0 -0
  29. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/__main__.py +0 -0
  30. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/capsule_middleware.py +0 -0
  31. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/cli/__init__.py +0 -0
  32. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/cli/deploy_cmd.py +0 -0
  33. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/cli/main.py +0 -0
  34. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/cli/serve.py +0 -0
  35. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/collector.py +0 -0
  36. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/context.py +0 -0
  37. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/cost_adapter.py +0 -0
  38. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/decorators.py +0 -0
  39. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/instrumentation/__init__.py +0 -0
  40. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/instrumentation/anthropic_instr.py +0 -0
  41. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/instrumentation/base.py +0 -0
  42. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/instrumentation/google_instr.py +0 -0
  43. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/instrumentation/openai_instr.py +0 -0
  44. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/instrumentation/registry.py +0 -0
  45. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/kalibr.py +0 -0
  46. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/kalibr_app.py +0 -0
  47. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/middleware/__init__.py +0 -0
  48. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/models.py +0 -0
  49. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/redaction.py +0 -0
  50. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/schemas.py +0 -0
  51. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/tokens.py +0 -0
  52. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/trace_capsule.py +0 -0
  53. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/trace_models.py +0 -0
  54. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/tracer.py +0 -0
  55. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr/types.py +0 -0
  56. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr.egg-info/dependency_links.txt +0 -0
  57. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/kalibr.egg-info/entry_points.txt +0 -0
  58. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/setup.cfg +0 -0
  59. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/tests/test_capsule_builder.py +0 -0
  60. {kalibr-1.1.1a0 → kalibr-1.1.3a0}/tests/test_instrumentation.py +0 -0
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.4
2
+ Name: kalibr
3
+ Version: 1.1.3a0
4
+ Summary: Unified LLM Observability & Multi-Model AI Integration Framework - Deploy to GPT, Claude, Gemini, Copilot with full telemetry.
5
+ Author-email: Kalibr Team <team@kalibr.dev>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/kalibr-ai/kalibr-sdk-python
8
+ Project-URL: Documentation, https://docs.kalibr.systems
9
+ Project-URL: Repository, https://github.com/kalibr-ai/kalibr-sdk-python
10
+ Project-URL: Issues, https://github.com/kalibr-ai/kalibr-sdk-python/issues
11
+ Keywords: ai,mcp,gpt,claude,gemini,copilot,openai,anthropic,google,microsoft,observability,telemetry,tracing,llm,schema-generation,api,multi-model,langchain,crewai
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: httpx>=0.27.0
27
+ Requires-Dist: tiktoken>=0.8.0
28
+ Requires-Dist: fastapi>=0.110.1
29
+ Requires-Dist: uvicorn>=0.25.0
30
+ Requires-Dist: pydantic>=2.6.4
31
+ Requires-Dist: typer>=0.9.0
32
+ Requires-Dist: python-multipart>=0.0.9
33
+ Requires-Dist: rich>=10.0.0
34
+ Requires-Dist: requests>=2.31.0
35
+ Requires-Dist: opentelemetry-api>=1.20.0
36
+ Requires-Dist: opentelemetry-sdk>=1.20.0
37
+ Requires-Dist: opentelemetry-exporter-otlp>=1.20.0
38
+ Provides-Extra: langchain
39
+ Requires-Dist: langchain-core>=0.1.0; extra == "langchain"
40
+ Provides-Extra: langchain-openai
41
+ Requires-Dist: langchain-core>=0.1.0; extra == "langchain-openai"
42
+ Requires-Dist: langchain-openai>=0.1.0; extra == "langchain-openai"
43
+ Provides-Extra: langchain-anthropic
44
+ Requires-Dist: langchain-core>=0.1.0; extra == "langchain-anthropic"
45
+ Requires-Dist: langchain-anthropic>=0.1.0; extra == "langchain-anthropic"
46
+ Provides-Extra: langchain-google
47
+ Requires-Dist: langchain-core>=0.1.0; extra == "langchain-google"
48
+ Requires-Dist: langchain-google-genai>=0.0.10; extra == "langchain-google"
49
+ Provides-Extra: langchain-all
50
+ Requires-Dist: langchain-core>=0.1.0; extra == "langchain-all"
51
+ Requires-Dist: langchain-openai>=0.1.0; extra == "langchain-all"
52
+ Requires-Dist: langchain-anthropic>=0.1.0; extra == "langchain-all"
53
+ Requires-Dist: langchain-google-genai>=0.0.10; extra == "langchain-all"
54
+ Provides-Extra: crewai
55
+ Requires-Dist: crewai>=0.28.0; extra == "crewai"
56
+ Provides-Extra: openai-agents
57
+ Requires-Dist: openai-agents>=0.0.3; extra == "openai-agents"
58
+ Provides-Extra: integrations
59
+ Requires-Dist: langchain-core>=0.1.0; extra == "integrations"
60
+ Requires-Dist: crewai>=0.28.0; extra == "integrations"
61
+ Requires-Dist: openai-agents>=0.0.3; extra == "integrations"
62
+ Provides-Extra: dev
63
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
64
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
65
+ Requires-Dist: black>=23.0.0; extra == "dev"
66
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
67
+ Dynamic: license-file
68
+
69
+ # Kalibr Python SDK
70
+
71
+ Production-grade observability for LLM applications. Automatically instrument OpenAI, Anthropic, and Google AI SDKs with zero code changes.
72
+
73
+ ## Features
74
+
75
+ - **Zero-code instrumentation** - Automatic tracing for OpenAI, Anthropic, and Google AI
76
+ - **Cost tracking** - Real-time cost calculation for all LLM calls
77
+ - **Token monitoring** - Track input/output tokens across providers
78
+ - **Parent-child traces** - Automatic trace relationship management
79
+ - **Multi-provider support** - Works with GPT-4, Claude, Gemini, and more
80
+
81
+ ## Installation
82
+
83
+ ```bash
84
+ pip install kalibr
85
+ ```
86
+
87
+ ## Quick Start
88
+
89
+ ### Auto-instrumentation (Recommended)
90
+
91
+ Simply import `kalibr` at the start of your application - all LLM calls are automatically traced:
92
+
93
+ ```python
94
+ import kalibr # Enable auto-instrumentation
95
+ import openai
96
+
97
+ # Set your Kalibr API key
98
+ import os
99
+ os.environ["KALIBR_API_KEY"] = "your-kalibr-api-key"
100
+
101
+ # All OpenAI calls are now automatically traced
102
+ client = openai.OpenAI()
103
+ response = client.chat.completions.create(
104
+ model="gpt-4o",
105
+ messages=[{"role": "user", "content": "Hello!"}]
106
+ )
107
+ ```
108
+
109
+ ### Manual Tracing with Decorator
110
+
111
+ For more control, use the `@trace` decorator:
112
+
113
+ ```python
114
+ from kalibr import trace
115
+ import openai
116
+
117
+ @trace(operation="summarize", provider="openai", model="gpt-4o")
118
+ def summarize_text(text: str) -> str:
119
+ client = openai.OpenAI()
120
+ response = client.chat.completions.create(
121
+ model="gpt-4o",
122
+ messages=[
123
+ {"role": "system", "content": "Summarize the following text."},
124
+ {"role": "user", "content": text}
125
+ ]
126
+ )
127
+ return response.choices[0].message.content
128
+
129
+ result = summarize_text("Your long text here...")
130
+ ```
131
+
132
+ ### Multi-Provider Example
133
+
134
+ ```python
135
+ import kalibr
136
+ import openai
137
+ import anthropic
138
+
139
+ # OpenAI call - automatically traced
140
+ openai_client = openai.OpenAI()
141
+ gpt_response = openai_client.chat.completions.create(
142
+ model="gpt-4o",
143
+ messages=[{"role": "user", "content": "Explain quantum computing"}]
144
+ )
145
+
146
+ # Anthropic call - automatically traced
147
+ anthropic_client = anthropic.Anthropic()
148
+ claude_response = anthropic_client.messages.create(
149
+ model="claude-sonnet-4-20250514",
150
+ max_tokens=1024,
151
+ messages=[{"role": "user", "content": "Explain machine learning"}]
152
+ )
153
+ ```
154
+
155
+ ## Configuration
156
+
157
+ Configure the SDK using environment variables:
158
+
159
+ | Variable | Description | Default |
160
+ |----------|-------------|---------|
161
+ | `KALIBR_API_KEY` | API key for authentication | *Required* |
162
+ | `KALIBR_COLLECTOR_URL` | Collector endpoint URL | `http://localhost:8001/api/ingest` |
163
+ | `KALIBR_TENANT_ID` | Tenant identifier for multi-tenant setups | `default` |
164
+ | `KALIBR_WORKFLOW_ID` | Workflow identifier for grouping traces | `default` |
165
+ | `KALIBR_SERVICE_NAME` | Service name for OpenTelemetry spans | `kalibr-app` |
166
+ | `KALIBR_ENVIRONMENT` | Environment (prod, staging, dev) | `prod` |
167
+ | `KALIBR_AUTO_INSTRUMENT` | Enable/disable auto-instrumentation | `true` |
168
+ | `KALIBR_CONSOLE_EXPORT` | Enable console span export for debugging | `false` |
169
+
170
+ ## CLI Tools
171
+
172
+ The SDK includes command-line tools for running and deploying applications:
173
+
174
+ ```bash
175
+ # Run your app locally with tracing
176
+ kalibr serve myapp.py
177
+
178
+ # Run with managed runtime lifecycle
179
+ kalibr run myapp.py --port 8000
180
+
181
+ # Deploy to cloud platforms
182
+ kalibr deploy myapp.py --runtime fly.io
183
+
184
+ # Fetch trace data by ID
185
+ kalibr capsule <trace-id>
186
+ ```
187
+
188
+ ## Supported Providers
189
+
190
+ | Provider | Models | Auto-Instrumentation |
191
+ |----------|--------|---------------------|
192
+ | OpenAI | GPT-4, GPT-4o, GPT-3.5 | Yes |
193
+ | Anthropic | Claude 3 Opus, Sonnet, Haiku | Yes |
194
+ | Google | Gemini Pro, Gemini Flash | Yes |
195
+
196
+ ## Examples
197
+
198
+ See the [`examples/`](./examples) directory for complete examples:
199
+
200
+ - `basic_example.py` - Simple tracing example
201
+ - `basic_agent.py` - Agent with auto-instrumentation
202
+ - `advanced_example.py` - Advanced tracing patterns
203
+ - `cross_vendor.py` - Multi-provider workflows
204
+ - `test_mas.py` - Multi-agent system demonstration
205
+
206
+ ## Development
207
+
208
+ ```bash
209
+ # Clone the repository
210
+ git clone https://github.com/kalibr-ai/kalibr-sdk-python.git
211
+ cd kalibr-sdk-python
212
+
213
+ # Install in development mode
214
+ pip install -e ".[dev]"
215
+
216
+ # Run tests
217
+ pytest
218
+
219
+ # Format code
220
+ black kalibr/
221
+ ruff check kalibr/
222
+ ```
223
+
224
+ ## Contributing
225
+
226
+ We welcome contributions! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
227
+
228
+ ## License
229
+
230
+ MIT License - see [LICENSE](./LICENSE) for details.
231
+
232
+ ## Links
233
+
234
+ - [Documentation](https://docs.kalibr.systems)
235
+ - [GitHub Issues](https://github.com/kalibr-ai/kalibr-sdk-python/issues)
236
+ - [PyPI Package](https://pypi.org/project/kalibr/)
@@ -0,0 +1,168 @@
1
+ # Kalibr Python SDK
2
+
3
+ Production-grade observability for LLM applications. Automatically instrument OpenAI, Anthropic, and Google AI SDKs with zero code changes.
4
+
5
+ ## Features
6
+
7
+ - **Zero-code instrumentation** - Automatic tracing for OpenAI, Anthropic, and Google AI
8
+ - **Cost tracking** - Real-time cost calculation for all LLM calls
9
+ - **Token monitoring** - Track input/output tokens across providers
10
+ - **Parent-child traces** - Automatic trace relationship management
11
+ - **Multi-provider support** - Works with GPT-4, Claude, Gemini, and more
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pip install kalibr
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ### Auto-instrumentation (Recommended)
22
+
23
+ Simply import `kalibr` at the start of your application - all LLM calls are automatically traced:
24
+
25
+ ```python
26
+ import kalibr # Enable auto-instrumentation
27
+ import openai
28
+
29
+ # Set your Kalibr API key
30
+ import os
31
+ os.environ["KALIBR_API_KEY"] = "your-kalibr-api-key"
32
+
33
+ # All OpenAI calls are now automatically traced
34
+ client = openai.OpenAI()
35
+ response = client.chat.completions.create(
36
+ model="gpt-4o",
37
+ messages=[{"role": "user", "content": "Hello!"}]
38
+ )
39
+ ```
40
+
41
+ ### Manual Tracing with Decorator
42
+
43
+ For more control, use the `@trace` decorator:
44
+
45
+ ```python
46
+ from kalibr import trace
47
+ import openai
48
+
49
+ @trace(operation="summarize", provider="openai", model="gpt-4o")
50
+ def summarize_text(text: str) -> str:
51
+ client = openai.OpenAI()
52
+ response = client.chat.completions.create(
53
+ model="gpt-4o",
54
+ messages=[
55
+ {"role": "system", "content": "Summarize the following text."},
56
+ {"role": "user", "content": text}
57
+ ]
58
+ )
59
+ return response.choices[0].message.content
60
+
61
+ result = summarize_text("Your long text here...")
62
+ ```
63
+
64
+ ### Multi-Provider Example
65
+
66
+ ```python
67
+ import kalibr
68
+ import openai
69
+ import anthropic
70
+
71
+ # OpenAI call - automatically traced
72
+ openai_client = openai.OpenAI()
73
+ gpt_response = openai_client.chat.completions.create(
74
+ model="gpt-4o",
75
+ messages=[{"role": "user", "content": "Explain quantum computing"}]
76
+ )
77
+
78
+ # Anthropic call - automatically traced
79
+ anthropic_client = anthropic.Anthropic()
80
+ claude_response = anthropic_client.messages.create(
81
+ model="claude-sonnet-4-20250514",
82
+ max_tokens=1024,
83
+ messages=[{"role": "user", "content": "Explain machine learning"}]
84
+ )
85
+ ```
86
+
87
+ ## Configuration
88
+
89
+ Configure the SDK using environment variables:
90
+
91
+ | Variable | Description | Default |
92
+ |----------|-------------|---------|
93
+ | `KALIBR_API_KEY` | API key for authentication | *Required* |
94
+ | `KALIBR_COLLECTOR_URL` | Collector endpoint URL | `http://localhost:8001/api/ingest` |
95
+ | `KALIBR_TENANT_ID` | Tenant identifier for multi-tenant setups | `default` |
96
+ | `KALIBR_WORKFLOW_ID` | Workflow identifier for grouping traces | `default` |
97
+ | `KALIBR_SERVICE_NAME` | Service name for OpenTelemetry spans | `kalibr-app` |
98
+ | `KALIBR_ENVIRONMENT` | Environment (prod, staging, dev) | `prod` |
99
+ | `KALIBR_AUTO_INSTRUMENT` | Enable/disable auto-instrumentation | `true` |
100
+ | `KALIBR_CONSOLE_EXPORT` | Enable console span export for debugging | `false` |
101
+
102
+ ## CLI Tools
103
+
104
+ The SDK includes command-line tools for running and deploying applications:
105
+
106
+ ```bash
107
+ # Run your app locally with tracing
108
+ kalibr serve myapp.py
109
+
110
+ # Run with managed runtime lifecycle
111
+ kalibr run myapp.py --port 8000
112
+
113
+ # Deploy to cloud platforms
114
+ kalibr deploy myapp.py --runtime fly.io
115
+
116
+ # Fetch trace data by ID
117
+ kalibr capsule <trace-id>
118
+ ```
119
+
120
+ ## Supported Providers
121
+
122
+ | Provider | Models | Auto-Instrumentation |
123
+ |----------|--------|---------------------|
124
+ | OpenAI | GPT-4, GPT-4o, GPT-3.5 | Yes |
125
+ | Anthropic | Claude 3 Opus, Sonnet, Haiku | Yes |
126
+ | Google | Gemini Pro, Gemini Flash | Yes |
127
+
128
+ ## Examples
129
+
130
+ See the [`examples/`](./examples) directory for complete examples:
131
+
132
+ - `basic_example.py` - Simple tracing example
133
+ - `basic_agent.py` - Agent with auto-instrumentation
134
+ - `advanced_example.py` - Advanced tracing patterns
135
+ - `cross_vendor.py` - Multi-provider workflows
136
+ - `test_mas.py` - Multi-agent system demonstration
137
+
138
+ ## Development
139
+
140
+ ```bash
141
+ # Clone the repository
142
+ git clone https://github.com/kalibr-ai/kalibr-sdk-python.git
143
+ cd kalibr-sdk-python
144
+
145
+ # Install in development mode
146
+ pip install -e ".[dev]"
147
+
148
+ # Run tests
149
+ pytest
150
+
151
+ # Format code
152
+ black kalibr/
153
+ ruff check kalibr/
154
+ ```
155
+
156
+ ## Contributing
157
+
158
+ We welcome contributions! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
159
+
160
+ ## License
161
+
162
+ MIT License - see [LICENSE](./LICENSE) for details.
163
+
164
+ ## Links
165
+
166
+ - [Documentation](https://docs.kalibr.systems)
167
+ - [GitHub Issues](https://github.com/kalibr-ai/kalibr-sdk-python/issues)
168
+ - [PyPI Package](https://pypi.org/project/kalibr/)
@@ -1,36 +1,24 @@
1
- """Kalibr SDK v1.1.0 - Unified LLM Observability & Multi-Model AI Integration Framework
2
-
3
- This SDK combines:
4
- 1. Full LLM Observability with tracing, cost tracking, and analytics
5
- 2. Multi-Model AI Integration (GPT, Claude, Gemini, Copilot)
6
- 3. One-line deployment with Docker and runtime router
7
- 4. Schema generation for all major AI platforms
8
- 5. **NEW in 1.1.0**: Auto-instrumentation of LLM SDKs (OpenAI, Anthropic, Google)
1
+ """Kalibr SDK v1.1.0 - LLM Observability & Tracing Framework
9
2
 
10
3
  Features:
11
4
  - **Auto-Instrumentation**: Zero-config tracing of OpenAI, Anthropic, Google SDK calls
12
5
  - **OpenTelemetry**: OTel-compatible spans with OTLP export
13
6
  - **Tracing**: Complete telemetry with @trace decorator
14
7
  - **Cost Tracking**: Multi-vendor cost calculation (OpenAI, Anthropic, etc.)
15
- - **Deployment**: One-command deployment to Fly.io, Render, or local
16
- - **Schema Generation**: Auto-generate schemas for GPT Actions, Claude MCP, Gemini, Copilot
17
8
  - **Error Handling**: Automatic error capture with stack traces
18
9
  - **Analytics**: ClickHouse-backed analytics and alerting
19
10
 
20
- Usage - Auto-Instrumentation (NEW):
21
- from kalibr import Kalibr
11
+ Usage - Auto-Instrumentation:
12
+ from kalibr import auto_instrument
22
13
  import openai # Automatically instrumented!
23
14
 
24
- app = Kalibr(title="My API")
15
+ auto_instrument(["openai", "anthropic", "google"])
25
16
 
26
- @app.action("chat", "Chat with GPT")
27
- def chat(message: str):
28
- # This OpenAI call is automatically traced!
29
- response = openai.chat.completions.create(
30
- model="gpt-4",
31
- messages=[{"role": "user", "content": message}]
32
- )
33
- return response.choices[0].message.content
17
+ # All LLM calls are now traced automatically
18
+ response = openai.chat.completions.create(
19
+ model="gpt-4",
20
+ messages=[{"role": "user", "content": "Hello!"}]
21
+ )
34
22
 
35
23
  Usage - Manual Tracing:
36
24
  from kalibr import trace
@@ -44,8 +32,6 @@ Usage - Manual Tracing:
44
32
  return response
45
33
 
46
34
  CLI Usage:
47
- kalibr serve my_app.py # Run locally
48
- kalibr deploy my_app.py --runtime fly # Deploy to Fly.io
49
35
  kalibr run my_app.py # Run with auto-tracing
50
36
  kalibr version # Show version
51
37
  """
@@ -79,23 +65,10 @@ from .cost_adapter import (
79
65
  )
80
66
  from .instrumentation import auto_instrument, get_instrumented_providers
81
67
 
82
- # ============================================================================
83
- # SDK & DEPLOYMENT (from 1.0.30)
84
- # ============================================================================
85
- from .kalibr import Kalibr
86
- from .kalibr_app import KalibrApp
87
68
  from .models import EventData, TraceConfig
88
- from .schemas import (
89
- generate_copilot_schema,
90
- generate_gemini_schema,
91
- generate_mcp_schema,
92
- get_base_url,
93
- get_supported_models,
94
- )
95
69
  from .simple_tracer import trace
96
70
  from .trace_capsule import TraceCapsule, get_or_create_capsule
97
71
  from .tracer import SpanContext, Tracer
98
- from .types import FileUpload, Session
99
72
  from .utils import load_config_from_env
100
73
 
101
74
  if os.getenv("KALIBR_AUTO_INSTRUMENT", "true").lower() == "true":
@@ -145,21 +118,6 @@ __all__ = [
145
118
  # Utils
146
119
  "load_config_from_env",
147
120
  # ========================================================================
148
- # SDK & DEPLOYMENT
149
- # ========================================================================
150
- # SDK Classes
151
- "Kalibr",
152
- "KalibrApp",
153
- # Types
154
- "FileUpload",
155
- "Session",
156
- # Schema Generation
157
- "get_base_url",
158
- "generate_mcp_schema",
159
- "generate_gemini_schema",
160
- "generate_copilot_schema",
161
- "get_supported_models",
162
- # ========================================================================
163
121
  # PHASE 1: SDK INSTRUMENTATION & OPENTELEMETRY (v1.1.0)
164
122
  # ========================================================================
165
123
  # Auto-instrumentation
@@ -23,7 +23,7 @@ def capsule(
23
23
  None,
24
24
  "--api-url",
25
25
  "-u",
26
- help="Kalibr API base URL (default: from env KALIBR_API_URL or http://localhost:8001)",
26
+ help="Kalibr API base URL (default: from env KALIBR_API_URL or https://api.kalibr.systems)",
27
27
  envvar="KALIBR_API_URL",
28
28
  ),
29
29
  output: Optional[Path] = typer.Option(
@@ -66,7 +66,7 @@ def capsule(
66
66
  kalibr capsule abc-123-def -u https://api.kalibr.io
67
67
  """
68
68
  # Determine API base URL
69
- base_url = api_url or "http://localhost:8001"
69
+ base_url = api_url or "https://api.kalibr.systems"
70
70
  base_url = base_url.rstrip("/")
71
71
 
72
72
  # Build endpoint URL
@@ -56,8 +56,11 @@ def run(
56
56
  raise typer.Exit(1)
57
57
 
58
58
  # Configure backend
59
- backend = backend_url or os.getenv("KALIBR_BACKEND_URL", "http://localhost:8001")
60
- api_key = os.getenv("KALIBR_API_KEY", "test_key_12345")
59
+ backend = backend_url or os.getenv("KALIBR_BACKEND_URL", "https://api.kalibr.systems")
60
+ api_key = os.getenv("KALIBR_API_KEY")
61
+ if not api_key:
62
+ console.print("[yellow]⚠️ KALIBR_API_KEY not set. Set it for trace authentication.[/yellow]")
63
+ api_key = ""
61
64
 
62
65
  # Generate runtime metadata
63
66
  runtime_id = str(uuid.uuid4())
@@ -70,7 +70,7 @@ class KalibrClient:
70
70
 
71
71
  self.api_key = api_key or env_config.get("auth_token", "")
72
72
  self.endpoint = endpoint or env_config.get(
73
- "api_endpoint", "http://localhost:8001/api/v1/traces"
73
+ "api_endpoint", "https://api.kalibr.systems/api/v1/traces"
74
74
  )
75
75
  self.tenant_id = tenant_id or env_config.get("tenant_id", "default")
76
76
  self.environment = environment or env_config.get("environment", "prod")
@@ -54,7 +54,7 @@ class AutoTracerMiddleware(BaseHTTPMiddleware):
54
54
 
55
55
  # Collector config
56
56
  self.collector_url = collector_url or os.getenv(
57
- "KALIBR_COLLECTOR_URL", "http://localhost:8001/api/ingest"
57
+ "KALIBR_COLLECTOR_URL", "https://api.kalibr.systems/api/ingest"
58
58
  )
59
59
  self.api_key = api_key or os.getenv("KALIBR_API_KEY", "")
60
60
  self.tenant_id = tenant_id or os.getenv("KALIBR_TENANT_ID", "default")
@@ -53,8 +53,11 @@ def send_event(payload: dict):
53
53
  print("[Kalibr SDK] ❌ requests library not available")
54
54
  return
55
55
 
56
- url = os.getenv("KALIBR_COLLECTOR_URL", "http://localhost:8001/api/ingest")
57
- api_key = os.getenv("KALIBR_API_KEY", "test_key_12345")
56
+ url = os.getenv("KALIBR_COLLECTOR_URL", "https://api.kalibr.systems/api/ingest")
57
+ api_key = os.getenv("KALIBR_API_KEY")
58
+ if not api_key:
59
+ print("[Kalibr SDK] ⚠️ KALIBR_API_KEY not set, traces will not be sent")
60
+ return
58
61
 
59
62
  format_pref = os.getenv("KALIBR_COLLECTOR_FORMAT", "ndjson").lower()
60
63
  use_json_envelope = format_pref == "json"
@@ -120,7 +123,7 @@ def trace(
120
123
  parent_span_id = kwargs.pop("parent_span_id", None) # None or base62 string
121
124
 
122
125
  # Load environment config
123
- tenant_id = os.getenv("KALIBR_TENANT_ID", "emergent")
126
+ tenant_id = os.getenv("KALIBR_TENANT_ID", "default")
124
127
  workflow_id = os.getenv("KALIBR_WORKFLOW_ID", "multi_agent_demo")
125
128
  sandbox_id = os.getenv("SANDBOX_ID", "vercel_vm_001")
126
129
  runtime_env = os.getenv("RUNTIME_ENV", "vercel_vm")
@@ -38,8 +38,8 @@ def load_config_from_env() -> Dict[str, str]:
38
38
  "workflow_id": os.getenv("KALIBR_WORKFLOW_ID", "default-workflow"),
39
39
  "sandbox_id": os.getenv("SANDBOX_ID", "local"),
40
40
  "runtime_env": os.getenv("RUNTIME_ENV", "local"),
41
- "api_endpoint": os.getenv("KALIBR_API_ENDPOINT", "http://localhost:8001/api/v1/traces"),
42
- "collector_url": os.getenv("KALIBR_COLLECTOR_URL", "http://localhost:8080/api/ingest"),
41
+ "api_endpoint": os.getenv("KALIBR_API_ENDPOINT", "https://api.kalibr.systems/api/v1/traces"),
42
+ "collector_url": os.getenv("KALIBR_COLLECTOR_URL", "https://api.kalibr.systems/api/ingest"),
43
43
  }
44
44
  return config
45
45