1- # Overmind Python SDK
1+ # Overmind SDK
22
33[ ![ CI Checks] ( https://github.com/overmind-core/overmind-python/actions/workflows/publish.yml/badge.svg )] ( https://github.com/overmind-core/overmind-python/actions/workflows/publish.yml )
4- [ ![ PyPI version] ( https://img.shields.io/pypi/v/overmind.svg )] ( https://pypi.org/project/overmind/ )
4+ [ ![ PyPI version] ( https://img.shields.io/pypi/v/overmind-sdk .svg )] ( https://pypi.org/project/overmind-sdk / )
55
6- Automatic observability for LLM applications. One call to ` overmind. init()` instruments your existing OpenAI, Anthropic, Google Gemini, or Agno code — no proxy, no key sharing, no import changes.
6+ Automatic observability for LLM applications. One call to ` init() ` instruments your existing OpenAI, Anthropic, Google Gemini, or Agno code — no proxy, no key sharing, no import changes.
77
8- ## What is Overmind?
9-
10- Overmind automatically optimizes your AI agents — better prompts, better models, lower cost. It collects execution traces, evaluates them with LLM judges, and recommends better prompts and models to reduce cost, improve quality, and lower latency.
8+ ## Features
119
1210- ** Zero-change instrumentation** : Keep using your existing LLM clients as-is
1311- ** Auto-detection** : Detects installed providers automatically, or specify them explicitly
1412- ** Custom spans** : Add your own tracing spans alongside LLM calls
1513- ** User & tag context** : Tag traces with user IDs, custom attributes, and exceptions
1614- ** OpenTelemetry native** : Built on standard OTLP — works with any OTel-compatible backend
17- - ** Managed service** : [ console.overmindlab.ai] ( https://console.overmindlab.ai )
18- - ** Self-hosted (open-source)** : [ github.com/overmind-core/overmind] ( https://github.com/overmind-core/overmind )
19- - ** Docs** : [ docs.overmindlab.ai] ( https://docs.overmindlab.ai )
2015
2116## Installation
2217
2318``` bash
24- pip install overmind
19+ pip install overmind-sdk
2520```
2621
2722Install alongside your LLM provider package:
2823
2924``` bash
30- pip install overmind openai # OpenAI
31- pip install overmind anthropic # Anthropic
32- pip install overmind google-genai # Google Gemini
33- pip install overmind agno # Agno
25+ pip install overmind-sdk openai # OpenAI
26+ pip install overmind-sdk anthropic # Anthropic
27+ pip install overmind-sdk google-genai # Google Gemini
28+ pip install overmind-sdk agno # Agno
3429```
3530
3631---
@@ -43,12 +38,12 @@ Sign up at [console.overmindlab.ai](https://console.overmindlab.ai) — your API
4338
4439### 2. Initialize the SDK
4540
46- Call ` overmind. init()` once at application startup, before any LLM calls:
41+ Call ` init() ` once at application startup, before any LLM calls:
4742
4843``` python
49- import overmind
44+ from overmind_sdk import init
5045
51- overmind. init(
46+ init(
5247 overmind_api_key = " ovr_..." , # or set OVERMIND_API_KEY env var
5348 service_name = " my-service" ,
5449 environment = " production" ,
@@ -65,7 +60,7 @@ from openai import OpenAI
6560client = OpenAI() # your existing client, unchanged
6661
6762response = client.chat.completions.create(
68- model = " gpt-4o -mini" ,
63+ model = " gpt-5 -mini" ,
6964 messages = [{" role" : " user" , " content" : " Explain quantum computing" }],
7065)
7166print (response.choices[0 ].message.content)
@@ -80,29 +75,29 @@ Traces appear in your [Overmind dashboard](https://console.overmindlab.ai) in re
8075### OpenAI
8176
8277``` python
83- import overmind
78+ from overmind_sdk import init
8479from openai import OpenAI
8580
86- overmind. init(service_name = " my-service" , providers = [" openai" ])
81+ init(service_name = " my-service" , providers = [" openai" ])
8782
8883client = OpenAI()
8984response = client.chat.completions.create(
90- model = " gpt-4o-mini " ,
85+ model = " gpt-5 " ,
9186 messages = [{" role" : " user" , " content" : " Hello!" }],
9287)
9388```
9489
9590### Anthropic
9691
9792``` python
98- import overmind
93+ from overmind_sdk import init
9994import anthropic
10095
101- overmind. init(service_name = " my-service" , providers = [" anthropic" ])
96+ init(service_name = " my-service" , providers = [" anthropic" ])
10297
10398client = anthropic.Anthropic()
10499message = client.messages.create(
105- model = " claude-haiku -4-5" ,
100+ model = " claude-opus -4-5" ,
106101 max_tokens = 1024 ,
107102 messages = [{" role" : " user" , " content" : " Hello!" }],
108103)
@@ -111,10 +106,10 @@ message = client.messages.create(
111106### Google Gemini
112107
113108``` python
114- import overmind
109+ from overmind_sdk import init
115110from google import genai
116111
117- overmind. init(service_name = " my-service" , providers = [" google" ])
112+ init(service_name = " my-service" , providers = [" google" ])
118113
119114client = genai.Client()
120115response = client.models.generate_content(
@@ -126,39 +121,39 @@ response = client.models.generate_content(
126121### Agno
127122
128123``` python
129- import overmind
124+ from overmind_sdk import init
130125from agno.agent import Agent
131126from agno.models.openai import OpenAIChat
132127
133- overmind. init(service_name = " my-service" , providers = [" agno" ])
128+ init(service_name = " my-service" , providers = [" agno" ])
134129
135- agent = Agent(model = OpenAIChat(id = " gpt-4o-mini " ), markdown = True , name = " Storyteller " )
130+ agent = Agent(model = OpenAIChat(id = " gpt-5 " ), markdown = True )
136131agent.print_response(" Write a short poem about the sea." )
137132```
138133
139134### Auto-detect all installed providers
140135
141- Omit ` providers ` (or pass an empty list ) to automatically instrument every supported provider that is installed:
136+ Pass an empty ` providers ` list (or omit it ) to automatically instrument every supported provider that is installed:
142137
143138``` python
144- import overmind
139+ from overmind_sdk import init
145140
146- overmind. init(service_name = " my-service" ) # auto-detects openai, anthropic, google, agno
141+ init(service_name = " my-service" ) # auto-detects openai, anthropic, google, agno
147142```
148143
149144---
150145
151146## Configuration
152147
153- ### ` overmind. init()` parameters
148+ ### ` init() ` parameters
154149
155150| Parameter | Type | Default | Description |
156151| -----------| ------| ---------| -------------|
157152| ` overmind_api_key ` | ` str \| None ` | ` None ` | Your Overmind API key. Falls back to ` OVERMIND_API_KEY ` env var. |
158- | ` service_name ` | ` str ` | ` "unknown-service" ` | Name of your service (shown in traces). Also reads ` OVERMIND_SERVICE_NAME ` . |
159- | ` environment ` | ` str ` | ` "development" ` | Deployment environment (` "production" ` , ` "staging" ` , etc.). Also reads ` OVERMIND_ENVIRONMENT ` . |
160- | ` providers ` | ` list[str] \| None ` | ` None ` | Providers to instrument. Supported: ` "openai" ` , ` "anthropic" ` , ` "google" ` , ` "agno" ` . ` None ` or ` [] ` = auto-detect all installed . |
161- | ` overmind_base_url ` | ` str \| None ` | ` None ` | Override the Overmind API URL. Falls back to ` OVERMIND_API_URL ` or ` https://api.overmindlab.ai ` . |
153+ | ` service_name ` | ` str \| None ` | ` None ` | Name of your service (shown in traces). Also reads ` OVERMIND_SERVICE_NAME ` . Defaults to ` "unknown-service" ` . |
154+ | ` environment ` | ` str \| None ` | ` None ` | Deployment environment (` "production" ` , ` "staging" ` , etc.). Also reads ` OVERMIND_ENVIRONMENT ` . Defaults to ` "development" ` . |
155+ | ` providers ` | ` list[str] \| None ` | ` None ` | Providers to instrument. Supported: ` "openai" ` , ` "anthropic" ` , ` "google" ` , ` "agno" ` . ` None ` or empty = auto-detect. |
156+ | ` overmind_base_url ` | ` str \| None ` | ` None ` | Override the Overmind API URL. Falls back to ` OVERMIND_API_URL ` env var, then ` https://api.overmindlab.ai ` . |
162157
163158### Environment variables
164159
@@ -169,42 +164,38 @@ overmind.init(service_name="my-service") # auto-detects openai, anthropic, goog
169164| ` OVERMIND_ENVIRONMENT ` | Environment name (overridden by ` environment ` param) |
170165| ` OVERMIND_API_URL ` | Custom API endpoint URL |
171166
172- ### Self-Hosted
173-
174- The SDK works with both the managed service and the [ self-hosted open-source edition] ( https://github.com/overmind-core/overmind ) . API keys prefixed with ` ovr_core_ ` are automatically routed to ` http://localhost:8000 ` . You can also set ` OVERMIND_API_URL ` to point to your own deployment.
175-
176167---
177168
178169## Additional SDK Functions
179170
180- ### ` overmind. get_tracer()`
171+ ### ` get_tracer() `
181172
182173Get the OpenTelemetry tracer to create custom spans around any block of code:
183174
184175``` python
185- import overmind
176+ from overmind_sdk import init, get_tracer
186177
187- overmind. init(service_name = " my-service" )
178+ init(service_name = " my-service" )
188179
189- tracer = overmind. get_tracer()
180+ tracer = get_tracer()
190181
191182with tracer.start_as_current_span(" process-document" ) as span:
192183 span.set_attribute(" document.id" , doc_id)
193184 result = process(doc)
194185```
195186
196- ### ` overmind. set_user()`
187+ ### ` set_user() `
197188
198189Tag the current trace with user identity. Call this in your request handler or middleware:
199190
200191``` python
201- import overmind
192+ from overmind_sdk import set_user
202193
203194# In a FastAPI middleware:
204195@app.middleware (" http" )
205196async def add_user_context (request : Request, call_next ):
206197 if request.state.user:
207- overmind. set_user(
198+ set_user(
208199 user_id = request.state.user.id,
209200 email = request.state.user.email,
210201 )
@@ -217,24 +208,28 @@ async def add_user_context(request: Request, call_next):
217208| ` email ` | No | User's email address |
218209| ` username ` | No | User's display name |
219210
220- ### ` overmind. set_tag()`
211+ ### ` set_tag() `
221212
222213Add a custom attribute to the current span:
223214
224215``` python
225- overmind.set_tag(" feature.flag" , " new-checkout-flow" )
226- overmind.set_tag(" tenant.id" , tenant_id)
216+ from overmind_sdk import set_tag
217+
218+ set_tag(" feature.flag" , " new-checkout-flow" )
219+ set_tag(" tenant.id" , tenant_id)
227220```
228221
229- ### ` overmind. capture_exception()`
222+ ### ` capture_exception() `
230223
231224Record an exception on the current span and mark it as an error:
232225
233226``` python
227+ from overmind_sdk import capture_exception
228+
234229try :
235230 result = risky_llm_call()
236231except Exception as e:
237- overmind. capture_exception(e)
232+ capture_exception(e)
238233 raise
239234```
240235
@@ -244,12 +239,12 @@ except Exception as e:
244239
245240``` python
246241import os
247- import overmind
242+ from overmind_sdk import init, get_tracer, set_user, set_tag, capture_exception
248243from openai import OpenAI
249244
250245os.environ[" OVERMIND_API_KEY" ] = " ovr_your_key_here"
251246
252- overmind. init(
247+ init(
253248 service_name = " customer-support" ,
254249 environment = " production" ,
255250 providers = [" openai" ],
@@ -258,21 +253,22 @@ overmind.init(
258253client = OpenAI()
259254
260255def handle_query (user_id : str , question : str ) -> str :
261- overmind.set_user(user_id = user_id)
256+ set_user(user_id = user_id)
257+ set_tag(" workflow" , " support" )
262258
263- tracer = overmind. get_tracer()
259+ tracer = get_tracer()
264260 with tracer.start_as_current_span(" handle-support-query" ):
265261 try :
266262 response = client.chat.completions.create(
267- model = " gpt-4o -mini" ,
263+ model = " gpt-5 -mini" ,
268264 messages = [
269265 {" role" : " system" , " content" : " You are a helpful customer support agent." },
270266 {" role" : " user" , " content" : question},
271267 ],
272268 )
273269 return response.choices[0 ].message.content
274270 except Exception as e:
275- overmind. capture_exception(e)
271+ capture_exception(e)
276272 raise
277273
278274answer = handle_query(" user-123" , " How do I reset my password?" )
@@ -283,7 +279,7 @@ print(answer)
283279
284280## What Happens After Your First Traces
285281
286- Once Overmind has collected 30 + traces for a given prompt pattern, the optimization engine starts automatically:
282+ Once Overmind has collected 10 + traces for a given prompt pattern, the optimization engine starts automatically:
287283
2882841 . ** Agent detection** — extracts prompt templates from your traces
2892852 . ** LLM judge scoring** — evaluates each trace against auto-generated quality criteria
@@ -295,17 +291,4 @@ See [How Optimization Works](https://docs.overmindlab.ai/guides/how-it-works) fo
295291
296292---
297293
298- ## Documentation
299-
300- - [ Full documentation] ( https://docs.overmindlab.ai )
301- - [ Python SDK reference] ( https://docs.overmindlab.ai/guides/sdk-reference )
302- - [ JavaScript/TypeScript SDK] ( https://docs.overmindlab.ai/guides/sdk-js )
303- - [ Self-hosted platform (OSS)] ( https://github.com/overmind-core/overmind )
304-
305- ## License
306-
307- MIT
308-
309- ---
310-
311294We appreciate any feedback or suggestions. Reach out at [ support@overmindlab.ai ] ( mailto:support@overmindlab.ai )
0 commit comments