### Provider Examples Source: https://docs.overmindlab.ai/guides/sdk-python Examples of initializing the SDK with different LLM providers. ```APIDOC from overmind import init from openai import OpenAI init(service_name="my-service", providers=["openai"]) client = OpenAI() response = client.chat.completions.create( model="gpt-5-mini", messages=[{"role": "user", "content": "What is quantum computing?"}], ) print(response.choices[0].message.content) # Anthropic from overmind import init import anthropic init(service_name="my-service", providers=["anthropic"]) client = anthropic.Anthropic() message = client.messages.create( model="claude-opus-4-5", max_tokens=1024, messages=[{"role": "user", "content": "What is quantum computing?"}], ) print(message.content[0].text) # Google Gemini from overmind import init from google import genai init(service_name="my-service", providers=["google"]) client = genai.Client() response = client.models.generate_content( model="gemini-2.0-flash", contents="What is quantum computing?", ) print(response.text) # Agno from overmind import init from agno.agent import Agent from agno.models.openai import OpenAIChat init(service_name="my-service", providers=["agno"]) agent = Agent(model=OpenAIChat(id="gpt-5"), markdown=True) agent.print_response("Write a haiku about the ocean.") # Auto-detect all installed providers from overmind import init init(service_name="my-service") # auto-instruments every supported package that is installed ``` -------------------------------- ### Agno Provider Example Source: https://docs.overmindlab.ai/guides/sdk-python Initialize the SDK for Agno and use the Agno Agent to get a response. The SDK automatically traces this call. ```python from overmind import init from agno.agent import Agent from agno.models.openai import OpenAIChat init(service_name="my-service", providers=["agno"]) agent = Agent(model=OpenAIChat(id="gpt-5"), markdown=True) agent.print_response("Write a haiku about the ocean.") ``` -------------------------------- ### Installation Source: https://docs.overmindlab.ai/guides/sdk-python Install the Overmind SDK and optional provider integrations. ```APIDOC pip install overmind pip install overmind openai # OpenAI pip install overmind anthropic # Anthropic pip install overmind google-genai # Google Gemini pip install overmind agno # Agno ``` -------------------------------- ### Install SDK and Providers Source: https://docs.overmindlab.ai/guides/sdk-js Install the Overmind tracing SDK along with the specific LLM provider packages you intend to use. ```bash # OpenAI npm install @overmind-lab/trace-sdk openai # Anthropic npm install @overmind-lab/trace-sdk @anthropic-ai/sdk # Google Gemini npm install @overmind-lab/trace-sdk @google/genai ``` -------------------------------- ### Install Overmind Lab with aiohttp Backend Source: https://docs.overmindlab.ai/api/python Install the library with the 'aiohttp' extra to enable it as an HTTP backend for improved concurrency. This command installs from the staging repository. ```bash pip install 'overmind_lab[aiohttp] @ git+ssh://git@github.com/stainless-sdks/overmind-lab-python.git' ``` -------------------------------- ### Install and Initialize Overmind Source: https://docs.overmindlab.ai/guides/skills Install the Overmind package using pip and initialize your agent project. This sets up the necessary configuration and installs IDE skills. ```bash pip install overmind overmind init ``` -------------------------------- ### Install and Initialize Overmind Source: https://docs.overmindlab.ai/guides/skills Run this command once per project to install the Overmind package and initialize the project structure. Ensure you are in the project directory. ```bash pip install overmind && overmind init ``` -------------------------------- ### Install Overmind and OpenAI SDK (Python) Source: https://docs.overmindlab.ai/guides/how-to-use-tracing Install the necessary Python packages for Overmind tracing and OpenAI integration. ```bash pip install overmind openai ``` -------------------------------- ### Full Overmind SDK Example Source: https://docs.overmindlab.ai/guides/sdk-python This example demonstrates initializing the Overmind SDK, setting user context and tags, and capturing exceptions within a traced function. Call `init()` once at the top of your entry point. Use `service_name` meaningfully for different agents. Tag traces with context using `set_user()` and `set_tag()`. ```python import os from overmind import init, get_tracer, set_user, set_tag, capture_exception from openai import OpenAI os.environ["OVERMIND_API_KEY"] = "ovr_your_key_here" init( service_name="customer-support", environment="production", providers=["openai"], ) client = OpenAI() def handle_support_query(user_id: str, question: str) -> str: set_user(user_id=user_id) set_tag("workflow", "support") tracer = get_tracer() with tracer.start_as_current_span("handle-query"): try: response = client.chat.completions.create( model="gpt-5-mini", messages=[ {"role": "system", "content": "You are a helpful customer support agent."}, {"role": "user", "content": question}, ], ) return response.choices[0].message.content except Exception as e: capture_exception(e) raise answer = handle_support_query("user-123", "How do I reset my password?") print(answer) ``` -------------------------------- ### Install Overmind SDK Source: https://docs.overmindlab.ai/guides/sdk-python Install the Overmind SDK using pip. Additional packages are available for specific LLM providers. ```bash pip install overmind ``` ```bash pip install overmind openai # OpenAI pip install overmind anthropic # Anthropic pip install overmind google-genai # Google Gemini pip install overmind agno # Agno ``` -------------------------------- ### Project Creation Response Example Source: https://docs.overmindlab.ai/api/python/resources/projects/methods/create This is an example of the JSON response received after successfully creating a project. It includes details like ID, timestamps, name, slug, and optional fields. ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "name": "name", "slug": "slug", "updated_at": "2019-12-27T18:11:19.117Z", "description": "description", "is_active": true, "settings": {} } ``` -------------------------------- ### Membership Add Response Example Source: https://docs.overmindlab.ai/api/python/resources/projects/subresources/memberships/methods/add This is an example of the JSON response received after successfully adding a user to a project membership. ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "project": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "updated_at": "2019-12-27T18:11:19.117Z", "user": 0, "user_email": "dev@stainless.com" } ``` -------------------------------- ### Usage Example Source: https://docs.overmindlab.ai/api/typescript Demonstrates how to initialize the client and make a basic authenticated request to retrieve the current user. ```APIDOC ## Usage Example This snippet shows how to instantiate the OvermindLab client and call the `retrieveCurrentUser` method. ### Method ```typescript client.auth.retrieveCurrentUser() ``` ### Request Example ```typescript import OvermindLab from 'overmind-lab'; const client = new OvermindLab({ environment: 'environment_1', // defaults to 'production' }); const response = await client.auth.retrieveCurrentUser(); console.log(response.id); ``` ### Response Example ```json { "id": "user_id_123", "name": "John Doe" } ``` ``` -------------------------------- ### Token Creation Response Example Source: https://docs.overmindlab.ai/api/python/resources/auth/subresources/token/methods/create This is an example of a successful response when creating authentication tokens, containing the access and refresh tokens. ```json { "access": "access", "refresh": "refresh" } ``` -------------------------------- ### Job Iteration Creation Response Example Source: https://docs.overmindlab.ai/api/python/resources/job_iterations/methods/create This is an example of the JSON response received after successfully creating a job iteration. ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "iteration_name": "iteration_name", "job": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "agent_code": "agent_code", "avg_score": 0, "description": "description", "dimension_scores": {}, "order": -9007199254740991, "status": "keep" } ``` -------------------------------- ### Register Response Example Source: https://docs.overmindlab.ai/api/python/resources/auth/methods/register This is an example of a successful response when registering a new user. It includes access and refresh tokens, along with user details. ```json { "access": "access", "refresh": "refresh", "user": { "id": 0, "email": "dev@stainless.com", "email_verified": true } } ``` -------------------------------- ### Create Job Response Example Source: https://docs.overmindlab.ai/api/resources/jobs/methods/create Example of a successful response when creating a job. ```APIDOC ## Response Example ### Success Response (200) - **id** (string) - Unique identifier for the job. - **created_at** (string) - Timestamp when the job was created. - **iterations** (array) - List of iterations for the job. - **id** (string) - Unique identifier for the iteration. - **created_at** (string) - Timestamp when the iteration was created. - **iteration_name** (string) - Name of the iteration. - **job** (string) - Identifier of the associated job. - **agent_code** (string) - Code of the agent used in the iteration. - **avg_score** (number) - Average score of the iteration. - **description** (string) - Description of the iteration. - **dimension_scores** (object) - Scores for different dimensions. - **order** (number) - Order of the iteration. - **status** (string) - Status of the iteration (e.g., "keep"). - **updated_at** (string) - Timestamp when the job was last updated. - **agent** (string) - Identifier of the agent used for the job. - **analyzer_model** (string) - The analyzer model used. - **backtest_results** (object) - Results from backtesting. - **baseline_score** (number) - The baseline score for the job. - **best_agent_code** (string) - The agent code that achieved the best score. - **best_score** (number) - The best score achieved. - **candidates_per_iteration** (number) - Number of candidates per iteration. - **celery_task_id** (string) - Celery task ID associated with the job. - **data_source** (string) - The data source used for the job. - **improvement** (number) - Improvement achieved by the job. - **job_type** (string) - Type of the job (e.g., "inference"). - **num_iterations** (number) - Total number of iterations. - **project** (string) - Identifier of the project the job belongs to. - **prompt_slug** (string) - Slug for the prompt used. - **report_markdown** (string) - Markdown report of the job results. - **result** (object) - The result of the job. - **status** (string) - Current status of the job (e.g., "pending"). - **triggered_by** (number) - Identifier of who or what triggered the job. ### Response Example ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "iterations": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "iteration_name": "iteration_name", "job": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "agent_code": "agent_code", "avg_score": 0, "description": "description", "dimension_scores": {}, "order": -9007199254740991, "status": "keep" } ], "updated_at": "2019-12-27T18:11:19.117Z", "agent": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "analyzer_model": "analyzer_model", "backtest_results": {}, "baseline_score": 0, "best_agent_code": "best_agent_code", "best_score": 0, "candidates_per_iteration": -9007199254740991, "celery_task_id": "celery_task_id", "data_source": "data_source", "improvement": 0, "job_type": "inference", "num_iterations": -9007199254740991, "project": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "prompt_slug": "prompt_slug", "report_markdown": "report_markdown", "result": {}, "status": "pending", "triggered_by": 0 } ``` ``` -------------------------------- ### Job Creation Response Example Source: https://docs.overmindlab.ai/api/typescript/resources/jobs/methods/create Example of a successful response when creating a job. ```APIDOC ## POST /resources/jobs ### Description Creates a new job. ### Method POST ### Endpoint /resources/jobs ### Response #### Success Response (200) - **id** (string) - Unique identifier for the job. - **created_at** (string) - Timestamp when the job was created. - **iterations** (array) - List of iterations for the job. - **id** (string) - Unique identifier for the iteration. - **created_at** (string) - Timestamp when the iteration was created. - **iteration_name** (string) - Name of the iteration. - **job** (string) - ID of the job this iteration belongs to. - **agent_code** (string) - Code of the agent used in this iteration. - **avg_score** (number) - Average score for the iteration. - **description** (string) - Description of the iteration. - **dimension_scores** (object) - Scores for different dimensions. - **order** (number) - Order of the iteration. - **status** (string) - Status of the iteration (e.g., 'keep'). - **updated_at** (string) - Timestamp when the job was last updated. - **agent** (string) - Identifier for the agent used. - **analyzer_model** (string) - The analyzer model used. - **backtest_results** (object) - Results from backtesting. - **baseline_score** (number) - The baseline score. - **best_agent_code** (string) - The code for the best agent. - **best_score** (number) - The best score achieved. - **candidates_per_iteration** (number) - Number of candidates per iteration. - **celery_task_id** (string) - Celery task ID associated with the job. - **data_source** (string) - The data source used for the job. - **improvement** (number) - The improvement achieved. - **job_type** (string) - The type of job (e.g., 'inference'). - **num_iterations** (number) - The total number of iterations. - **project** (string) - Identifier for the project. - **prompt_slug** (string) - Slug for the prompt. - **report_markdown** (string) - Markdown report of the job results. - **result** (object) - The result of the job. - **status** (string) - The current status of the job (e.g., 'pending'). - **triggered_by** (number) - Identifier for who triggered the job. #### Response Example ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "iterations": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "iteration_name": "iteration_name", "job": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "agent_code": "agent_code", "avg_score": 0, "description": "description", "dimension_scores": {}, "order": -9007199254740991, "status": "keep" } ], "updated_at": "2019-12-27T18:11:19.117Z", "agent": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "analyzer_model": "analyzer_model", "backtest_results": {}, "baseline_score": 0, "best_agent_code": "best_agent_code", "best_score": 0, "candidates_per_iteration": -9007199254740991, "celery_task_id": "celery_task_id", "data_source": "data_source", "improvement": 0, "job_type": "inference", "num_iterations": -9007199254740991, "project": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "prompt_slug": "prompt_slug", "report_markdown": "report_markdown", "result": {}, "status": "pending", "triggered_by": 0 } ``` ``` -------------------------------- ### Agent Creation Example Source: https://docs.overmindlab.ai/api/typescript Illustrates how to create a new agent by providing the necessary parameters and handling the response. ```APIDOC ## Agent Creation Example This example demonstrates how to create an agent using the `agents.create` method, including defining the request parameters and handling the response type. ### Method ```typescript client.agents.create(params: OvermindLab.AgentCreateParams) ``` ### Parameters #### Request Body - **name** (string) - Required - The name of the agent. - **project** (string) - Required - The ID of the project the agent belongs to. - **slug** (string) - Required - A unique slug for the agent. ### Request Example ```typescript import OvermindLab from 'overmind-lab'; const client = new OvermindLab({ environment: 'environment_1', // defaults to 'production' }); const params: OvermindLab.AgentCreateParams = { name: 'x', project: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', slug: 'slug', }; const agent: OvermindLab.AgentCreateResponse = await client.agents.create(params); ``` ### Response Example ```json { "id": "agent_id_456", "name": "x", "project": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "slug": "slug" } ``` ``` -------------------------------- ### Install Overmind Source: https://docs.overmindlab.ai/guides/getting-started Install the Overmind package using pip. Ensure you have Python 3.10 or higher. ```bash pip install overmind ``` -------------------------------- ### API Response Example (JSON) Source: https://docs.overmindlab.ai/api/python/resources/auth/methods/retrieve_current_user This is an example of the JSON response received when successfully retrieving the current user's profile. ```json { "id": 0, "email": "dev@stainless.com", "email_verified": true } ``` -------------------------------- ### API Key Creation Response Example Source: https://docs.overmindlab.ai/api/python/resources/auth/subresources/api_keys/methods/create This is an example of the JSON response received after successfully creating an API key. The 'key' field is shown only once. ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "key": "key", "name": "name", "prefix": "prefix" } ``` -------------------------------- ### List Services Response Example Source: https://docs.overmindlab.ai/api/python/resources/traces/methods/list_services This is an example of a successful response when listing services. It includes the total count of services and a list of service names. ```json { "count": 123, "results": [ "string" ], "next": "http://api.example.org/accounts/?page=4", "previous": "http://api.example.org/accounts/?page=2" } ``` -------------------------------- ### Dataset Activate Response Example Source: https://docs.overmindlab.ai/api/python/resources/datasets/methods/activate This is an example of a successful JSON response when activating a dataset. It includes details about the dataset, agent, and creation timestamp. ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "agent": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "datapoints": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "expected_output": {}, "input": {}, "order": 0, "persona": "persona", "tags": {} } ], "num_datapoints": 0, "version": 0, "generator_model": "generator_model", "metadata": {}, "name": "name", "policy_hash": "policy_hash", "source": "seed" } ``` -------------------------------- ### API Response Example Source: https://docs.overmindlab.ai/api/python/resources/projects/methods/list This is an example of a successful response when listing projects, showing the structure of the returned data including count, results, and pagination links. ```json { "count": 123, "results": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "name": "name", "slug": "slug", "updated_at": "2019-12-27T18:11:19.117Z", "description": "description", "is_active": true, "settings": {} } ], "next": "http://api.example.org/accounts/?page=4", "previous": "http://api.example.org/accounts/?page=2" } ``` -------------------------------- ### Install Overmind Trace SDK and OpenAI (JavaScript/TypeScript) Source: https://docs.overmindlab.ai/guides/how-to-use-tracing Install the Overmind trace SDK and the OpenAI client library using npm for your JavaScript or TypeScript project. ```bash npm install @overmind-lab/trace-sdk openai ``` -------------------------------- ### Install Overmind Lab TypeScript Library Source: https://docs.overmindlab.ai/api Use this command to install the Overmind Lab TypeScript client library via npm. ```bash npm install git+ssh://git@github.com:stainless-sdks/overmind-lab-typescript.git ``` -------------------------------- ### Anthropic Provider Example Source: https://docs.overmindlab.ai/guides/sdk-python Initialize the SDK for Anthropic and use the Anthropic client to create a message. The SDK automatically traces this call. ```python from overmind import init import anthropic init(service_name="my-service", providers=["anthropic"]) client = anthropic.Anthropic() message = client.messages.create( model="claude-opus-4-5", max_tokens=1024, messages=[{"role": "user", "content": "What is quantum computing?"}], ) print(message.content[0].text) ``` -------------------------------- ### Install Overmind Lab Python Library Source: https://docs.overmindlab.ai/api/python Install the library from the staging repository using pip. This command will be updated once the package is published to PyPI. ```bash pip install git+ssh://git@github.com/stainless-sdks/overmind-lab-python.git ``` -------------------------------- ### List Project Memberships Response Example Source: https://docs.overmindlab.ai/api/python/resources/projects/subresources/memberships/methods/list This is an example of the JSON response structure when successfully listing project memberships. It includes count, results, and pagination details. ```json { "count": 123, "results": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "project": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "updated_at": "2019-12-27T18:11:19.117Z", "user": 0, "user_email": "dev@stainless.com" } ], "next": "http://api.example.org/accounts/?page=4", "previous": "http://api.example.org/accounts/?page=2" } ``` -------------------------------- ### Initialize Overmind Configuration Source: https://docs.overmindlab.ai/ Initialize Overmind in your agent project directory. This configures API keys and installs necessary IDE skills. ```bash cd your-agent-project/ overmind init ``` -------------------------------- ### Auto-detect Providers Source: https://docs.overmindlab.ai/guides/sdk-python Initialize the SDK without specifying providers to automatically instrument all supported packages that are installed. ```python from overmind import init init(service_name="my-service") # auto-instruments every supported package that is installed ``` -------------------------------- ### Agent Policy Example Source: https://docs.overmindlab.ai/guides/overmind_optimizer Defines the rules and expectations for an agent's behavior, guiding the optimization process to ensure compliance with business logic. ```yaml # Agent Policy: Lead Qualification ## Purpose Qualifies inbound sales leads by analyzing company data and inquiry content. ``` -------------------------------- ### Quick Start with OpenAI Source: https://docs.overmindlab.ai/guides/sdk-js Initialize the Overmind client, enable OpenAI tracing, and then use the OpenAI client as usual. Ensure your OVERMIND_API_KEY and OPENAI_API_KEY environment variables are set. ```javascript import { OpenAI } from "openai"; import { OvermindClient } from "@overmind-lab/trace-sdk"; const overmindClient = new OvermindClient({ apiKey: process.env.OVERMIND_API_KEY!, appName: "my app", }); overmindClient.initTracing({ enableBatching: false, enabledProviders: { openai: OpenAI }, }); const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY }); const response = await openai.chat.completions.create({ model: "gpt-5-mini", messages: [{ role: "user", content: "Explain quantum computing" }], }); await overmindClient.shutdown(); ``` -------------------------------- ### Refresh Token Example (TypeScript) Source: https://docs.overmindlab.ai/api/typescript/resources/auth/subresources/token/methods/refresh Use this snippet to refresh an access token by providing a valid refresh token. Ensure you have the 'overmind-lab' SDK installed and initialized. ```typescript import OvermindLab from 'overmind-lab'; const client = new OvermindLab(); const response = await client.auth.token.refresh({ refresh: 'x' }); console.log(response.access); ``` -------------------------------- ### List Services (HTTP) Source: https://docs.overmindlab.ai/api/resources/traces/methods/list_services Use this endpoint to retrieve a list of all distinct service names. No specific setup is required beyond making an HTTP GET request. ```curl curl https://api.overmindlab.ai/api/traces/services/ ``` -------------------------------- ### Determine Installed Version Source: https://docs.overmindlab.ai/api/python Use this snippet to check the currently installed version of the overmind_lab package in your Python environment. Ensure the package is installed. ```python import overmind_lab print(overmind_lab.__version__) ``` -------------------------------- ### Initialize Overmind Project Source: https://docs.overmindlab.ai/guides/getting-started Navigate to your agent's project root and run 'overmind init'. This command sets up the .overmind/ directory, collects API keys, configures the analyzer model, and installs Agent Skills into your IDE. ```bash cd your-agent-project/ overmind init ``` -------------------------------- ### Quick Start with Anthropic Source: https://docs.overmindlab.ai/guides/sdk-js Initialize the Overmind client, enable Anthropic tracing, and then use the Anthropic client. Ensure your OVERMIND_API_KEY and ANTHROPIC_API_KEY environment variables are set. ```javascript import * as Anthropic from "@anthropic-ai/sdk"; import { OvermindClient } from "@overmind-lab/trace-sdk"; const overmindClient = new OvermindClient({ apiKey: process.env.OVERMIND_API_KEY!, appName: "my app", }); overmindClient.initTracing({ enableBatching: false, enabledProviders: { anthropic: Anthropic }, }); const client = new Anthropic.default({ apiKey: process.env.ANTHROPIC_API_KEY }); const message = await client.messages.create({ model: "claude-sonnet-4-20250514", max_tokens: 1024, messages: [{ role: "user", content: "Explain quantum computing" }], }); console.log(message.content[0].text); await overmindClient.shutdown(); ``` -------------------------------- ### Quick Start with Google Gemini Source: https://docs.overmindlab.ai/guides/sdk-js Initialize the Overmind client, enable Google Gemini tracing, and then use the Gemini client. Ensure your OVERMIND_API_KEY and GEMINI_API_KEY environment variables are set. ```javascript import * as GoogleGenAI from "@google/genai"; import { OvermindClient } from "@overmind-lab/trace-sdk"; const overmindClient = new OvermindClient({ apiKey: process.env.OVERMIND_API_KEY!, appName: "my app", }); overmindClient.initTracing({ enableBatching: false, enabledProviders: { googleGenAI: GoogleGenAI }, }); const client = new GoogleGenAI.GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY, }); const response = await client.models.generateContent({ model: "gemini-2.0-flash", contents: "Explain quantum computing", }); console.log(response.text); await overmindClient.shutdown(); ``` -------------------------------- ### Retrieve Trace Example Source: https://docs.overmindlab.ai/api/python/resources/traces/methods/retrieve This example shows a successful response when retrieving trace data. ```APIDOC ## GET /v1/traces ### Description Retrieves trace data. ### Method GET ### Endpoint /v1/traces ### Response #### Success Response (200) - **root** (object) - The root span of the trace. - **span_count** (integer) - The total number of spans in the trace. - **spans** (array) - A list of all spans within the trace. - **trace_id** (string) - The unique identifier for the trace. #### Response Example ```json { "root": { "agent": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "attributes": {}, "duration_ns": 0, "end_time_ns": 0, "events": {}, "is_root": true, "iteration": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "job": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "kind": 0, "links": {}, "name": "name", "operation": "operation", "parent_span_id": "parent_span_id", "project": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "received_at": "2019-12-27T18:11:19.117Z", "resource_attrs": {}, "scope_name": "scope_name", "scope_version": "scope_version", "service_name": "service_name", "span_id": "span_id", "span_type": "llm_call", "start_time_ns": 0, "status_code": 0, "status_message": "status_message", "trace_id": "trace_id" }, "span_count": 0, "spans": [ { "agent": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "attributes": {}, "duration_ns": 0, "end_time_ns": 0, "events": {}, "is_root": true, "iteration": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "job": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "kind": 0, "links": {}, "name": "name", "operation": "operation", "parent_span_id": "parent_span_id", "project": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "received_at": "2019-12-27T18:11:19.117Z", "resource_attrs": {}, "scope_name": "scope_name", "scope_version": "scope_version", "service_name": "service_name", "span_id": "span_id", "span_type": "llm_call", "start_time_ns": 0, "status_code": 0, "status_message": "status_message", "trace_id": "trace_id" } ], "trace_id": "trace_id" } ``` ``` -------------------------------- ### Initialize Overmind Tracing (Python) Source: https://docs.overmindlab.ai/guides/getting-started Install the Overmind Python tracing SDK and call 'overmind.init()' at your application's startup to enable Overmind traces. This is useful for monitoring deployed applications independently of the optimization workflow. ```bash pip install overmind ``` ```python import overmind overmind.init(service_name="my-service", environment="production") ``` -------------------------------- ### Google Gemini Provider Example Source: https://docs.overmindlab.ai/guides/sdk-python Initialize the SDK for Google Gemini and use the genai client to generate content. The SDK automatically traces this call. ```python from overmind import init from google import genai init(service_name="my-service", providers=["google"]) client = genai.Client() response = client.models.generate_content( model="gemini-2.0-flash", contents="What is quantum computing?", ) print(response.text) ``` -------------------------------- ### OpenAI Provider Example Source: https://docs.overmindlab.ai/guides/sdk-python Initialize the SDK for OpenAI and use the OpenAI client to make a chat completion request. The SDK automatically traces this call. ```python from overmind import init from openai import OpenAI init(service_name="my-service", providers=["openai"]) client = OpenAI() response = client.chat.completions.create( model="gpt-5-mini", messages=[{"role": "user", "content": "What is quantum computing?"}], ) print(response.choices[0].message.content) ``` -------------------------------- ### Create Agent with Basic Parameters Source: https://docs.overmindlab.ai/api/typescript/resources/agents/methods/create Demonstrates how to create a new agent by providing the required name, project ID, and slug. The agent's ID is logged upon successful creation. ```typescript import OvermindLab from 'overmind-lab'; const client = new OvermindLab(); const agent = await client.agents.create({ name: 'x', project: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', slug: 'slug', }); console.log(agent.id); ``` -------------------------------- ### Agent List Response Example Source: https://docs.overmindlab.ai/api/python/resources/agents/methods/list Example JSON structure for a successful response when listing agents, including count and results. ```json { "count": 123, "results": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "name": "name", "project": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "slug": "slug", "updated_at": "2019-12-27T18:11:19.117Z", "agent_path": "agent_path", "analyzer_model": "analyzer_model", "dataset_has_expected_output": true, "dataset_size": -9007199254740991, "description": "description", "display_name": "display_name", "entrypoint_fn": "entrypoint_fn", "model": "model", "status": "status", "structure_weight": 0, "tags": {}, "tool_usage_weight": 0, "total_points": 0 } ], "next": "http://api.example.org/accounts/?page=4", "previous": "http://api.example.org/accounts/?page=2" } ``` -------------------------------- ### Initialize Overmind for Auto-Detection of Python Providers Source: https://docs.overmindlab.ai/guides/integrations Call `init()` once at startup. If the `providers` list is empty or omitted, all installed providers will be auto-detected and instrumented. ```python from overmind import init init(service_name="my-service") # instruments all installed providers ``` -------------------------------- ### Initialize Overmind with Specific Python Providers Source: https://docs.overmindlab.ai/guides/integrations Call `overmind.init()` once at startup, specifying the providers you intend to use. Your existing LLM client code remains unchanged. ```python from overmind import init init(service_name="my-service", providers=["openai", "anthropic"]) ``` -------------------------------- ### Agent Eval Spec Response Example Source: https://docs.overmindlab.ai/api/python/resources/agents/methods/retrieve_eval_spec This is an example of the JSON response structure when successfully retrieving an agent's evaluation specification. ```json { "agent_description": "agent_description", "agent_path": "agent_path", "consistency_rules": {}, "fixed_elements": {}, "input_schema": {}, "optimizable_elements": {}, "output_fields": {}, "structure_weight": 0, "tool_config": {}, "tool_usage_weight": 0, "total_points": 0 } ``` -------------------------------- ### init() Parameters Source: https://docs.overmindlab.ai/guides/sdk-python Parameters for the `init()` function. ```APIDOC Parameter| Type| Default| Description ---|---|---|--- `overmind_api_key`| `str | None`| `None`| Your Overmind API key. Falls back to `OVERMIND_API_KEY` env var. `service_name`| `str | None`| `None`| Name of your service, shown in the dashboard. Also reads `OVERMIND_SERVICE_NAME` env var. Defaults to `"overmind-telemetry"`. `environment`| `str | None`| `None`| Deployment environment (`"production"`, `"staging"`, etc.). Also reads `OVERMIND_ENVIRONMENT` env var. Defaults to `"development"`. `providers`| `list[str] | None`| `None`| Which LLM providers to instrument. Supported: `"openai"`, `"anthropic"`, `"google"`, `"agno"`. `None` or empty list = auto-detect all installed providers. `overmind_base_url`| `str | None`| `None`| Override the Overmind API endpoint. Falls back to `OVERMIND_API_URL` env var, then `https://api.overmindlab.ai`. ``` -------------------------------- ### Agent Retrieval Response Example Source: https://docs.overmindlab.ai/api/resources/agents/methods/retrieve This is an example of a successful (200 OK) response when retrieving agent details. It includes all available fields for an agent. ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9aab26e", "created_at": "2019-12-27T18:11:19.117Z", "name": "name", "project": "182bd5e5-6e1a-4fe4-a799-aa6d9aab26e", "slug": "slug", "updated_at": "2019-12-27T18:11:19.117Z", "active_dataset": "182bd5e5-6e1a-4fe4-a799-aa6d9aab26e", "agent_description": {}, "agent_path": "agent_path", "analyzer_model": "analyzer_model", "backtest_metadata": {}, "backtest_model_suggestions": {}, "consistency_rules": {}, "dataset_has_expected_output": true, "dataset_input_keys": {}, "dataset_size": -9007199254740991, "description": "description", "display_name": "display_name", "entrypoint_fn": "entrypoint_fn", "eval_dataset": {}, "evaluation_criteria": {}, "fixed_elements": {}, "improvement_metadata": {}, "input_schema": {}, "is_deleted": true, "model": "model", "optimizable_elements": {}, "output_fields": {}, "output_schema": {}, "policy_data": {}, "policy_markdown": "policy_markdown", "proposed_criteria": {}, "status": "status", "structure_weight": 0, "tags": {}, "tool_analysis": {}, "tool_config": {}, "tool_usage_weight": 0, "total_points": 0 } ``` -------------------------------- ### Using Multiple Providers Source: https://docs.overmindlab.ai/guides/sdk-js Initialize the Overmind client and enable tracing for multiple LLM providers in a single `initTracing()` call. Batching is enabled for production use. ```javascript import { OpenAI } from "openai"; import * as Anthropic from "@anthropic-ai/sdk"; import * as GoogleGenAI from "@google/genai"; import { OvermindClient } from "@overmind-lab/trace-sdk"; const overmindClient = new OvermindClient({ apiKey: process.env.OVERMIND_API_KEY!, appName: "my app", }); overmindClient.initTracing({ enableBatching: true, enabledProviders: { openai: OpenAI, anthropic: Anthropic, googleGenAI: GoogleGenAI, }, }); ``` -------------------------------- ### List Projects (HTTP) Source: https://docs.overmindlab.ai/api/resources/projects/methods/list Use this command to list all projects. You can append query parameters to filter or order the results. ```bash curl https://api.overmindlab.ai/api/projects/ ``` -------------------------------- ### Example Response for Trace Retrieval Source: https://docs.overmindlab.ai/api/python/resources/traces/methods/retrieve This is an example of the JSON payload returned when a trace is successfully retrieved. It includes the root span and a list of all associated spans. ```json { "root": { "agent": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "attributes": {}, "duration_ns": 0, "end_time_ns": 0, "events": {}, "is_root": true, "iteration": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "job": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "kind": 0, "links": {}, "name": "name", "operation": "operation", "parent_span_id": "parent_span_id", "project": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "received_at": "2019-12-27T18:11:19.117Z", "resource_attrs": {}, "scope_name": "scope_name", "scope_version": "scope_version", "service_name": "service_name", "span_id": "span_id", "span_type": "llm_call", "start_time_ns": 0, "status_code": 0, "status_message": "status_message", "trace_id": "trace_id" }, "span_count": 0, "spans": [ { "agent": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "attributes": {}, "duration_ns": 0, "end_time_ns": 0, "events": {}, "is_root": true, "iteration": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "job": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "kind": 0, "links": {}, "name": "name", "operation": "operation", "parent_span_id": "parent_span_id", "project": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "received_at": "2019-12-27T18:11:19.117Z", "resource_attrs": {}, "scope_name": "scope_name", "scope_version": "scope_version", "service_name": "service_name", "span_id": "span_id", "span_type": "llm_call", "start_time_ns": 0, "status_code": 0, "status_message": "status_message", "trace_id": "trace_id" } ], "trace_id": "trace_id" } ``` -------------------------------- ### Initialize Overmind SDK Source: https://docs.overmindlab.ai/guides/sdk-python Initialize the SDK once at application startup. This automatically instruments existing LLM client code without requiring import changes or proxies. ```python from overmind import init init( overmind_api_key="ovr_...", service_name="my-service", environment="production", providers=["openai"], ) ```