Metadata-Version: 2.4
Name: maev-sdk
Version: 0.4.6
Summary: Maev AI Agent Observability SDK — one-liner instrumentation for AI agents
Project-URL: Homepage, https://maev.dev
Project-URL: Documentation, https://docs.maev.dev
Project-URL: Repository, https://github.com/ujjwalpreenja1308-web/veil
Author-email: Maev <eng@maev.dev>
License: MIT License
        
        Copyright (c) 2024 Veil
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: agents,ai,llm,observability,opentelemetry,telemetry
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: System :: Monitoring
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: openlit>=1.33.0
Description-Content-Type: text/markdown

# Maev Python SDK

One-liner observability for AI agents.

## Installation

```bash
pip install maev-sdk
```

## Quickstart

```python
import maev

maev.init(api_key="vl_xxx")
```

That's it. Add this before your agent runs. Maev automatically instruments
OpenAI, Anthropic, LangChain, CrewAI, LiteLLM, Gemini, Cohere, LlamaIndex,
and other popular LLM libraries, and sends all telemetry to your Maev dashboard.

## Serverless functions (Lambda, Cloud Functions, Vercel, etc.)

In long-running processes (servers, scripts, notebooks), Maev automatically
sends all telemetry when the process exits. No extra code needed.

In **serverless functions**, the process doesn't exit cleanly — it gets frozen
or killed by the platform the moment your handler returns. Any telemetry still
in the buffer is silently dropped, and your session never closes in the
dashboard.

Call `maev.flush()` at the end of your handler to force delivery before the
freeze:

```python
import maev

maev.init(api_key="vl_xxx", agent_name="My Lambda")

def handler(event, context):
    # ... your agent logic ...

    maev.flush()  # send everything before Lambda freezes
    return result
```

`flush()` does two things in order:
1. Forces the OpenTelemetry exporter to drain any buffered spans (LLM call data)
2. Sends a `session.end` event so Maev closes and classifies the session

It is safe to call multiple times — only the first call does anything.

**Environments where you must call `flush()`:**

| Platform | Why |
|---|---|
| AWS Lambda | Handler returns → process frozen immediately |
| Google Cloud Functions | Same — process suspended after return |
| Vercel / Netlify Functions | Execution context torn down after response |
| Azure Functions | Consumption plan freezes after invocation |

**Environments where `flush()` is optional** (but harmless):

- Long-running servers (FastAPI, Flask, Django)
- CLI scripts
- Jupyter notebooks
- Docker containers

## How it works

- Telemetry is collected and sent asynchronously — zero impact on your agent's performance.
- Sessions are automatically tracked from the first LLM call through to process exit.
- Failures are detected and classified server-side — no configuration required.
- Every failure triggers an alert in your Maev dashboard and via email.
- Active Maev Fix prompts refresh in the background and inject automatically into supported libraries.
- The SDK prints a terminal notice when a newer `maev-sdk` version is available on PyPI.

## Supported Libraries

Maev auto-instruments all major LLM frameworks including:

- OpenAI
- Anthropic
- LangChain
- CrewAI
- LiteLLM
- Google Gemini (`google-generativeai`)
- Cohere
- LlamaIndex
- Mistral
- AWS Bedrock
- And more

## Requirements

- Python >= 3.9

## Your API Key

Find your API key in the [Maev Dashboard](https://home.maev.dev/dashboard/settings) under Settings.
Keys follow the format `vl_` followed by 64 hex characters.

## Self-hosting

If you are running Maev on your own infrastructure, pass the `endpoint` parameter:

```python
maev.init(api_key="vl_xxx", endpoint="https://your-maev-instance.com")
```
