Metadata-Version: 2.4
Name: influxion
Version: 0.0.2
Summary: Influxion Python SDK
License: MIT
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Description-Content-Type: text/markdown

# Influxion Python SDK

Instrument your agents with the Influxion SDK to capture sessions and artifacts for evaluation.

## Installation

Install from PyPI:

```bash
pip install -U influxion
```

Or, if installing from source:

```bash
pip install -e ".[dev]"
```

## Quickstart

```python
from influxion import InfluxionClient

client = InfluxionClient(
    api_key="sk-...",   # or set INFLUXION_API_KEY environment variable
)

session_id = client.create_session(
    name="weekly-report-run",
    project_id="<your-project-id>",
    agent_id="report-agent",
    tags=["weekly"],
    metadata={"env": "prod"},
)

try:
    report = run_my_agent()

    # Record tool call for evaluation (optional)
    client.create_session_tool_call(
        session_id=session_id,
        tool_name="fetch_data",
        tool_input={"source": "api", "query": "Q4 revenue"},
        tool_output={"rows": 42, "status": "ok"},
    )

    # Record artifact for evaluation (optional)
    client.create_session_artifact(
        session_id=session_id,
        artifact_name="report",
        artifact=report,
        artifact_type="text",
    )

    client.end_session(session_id, success=True)

except Exception as e:
    client.end_session(session_id, success=False, failure_message=str(e))
    raise
```

## Async Usage

```python
from influxion import AsyncInfluxionClient

async with AsyncInfluxionClient() as client:
    session_id = await client.create_session(
        name="my-run",
        project_id="<your-project-id>",
        agent_id="my-agent",
    )
    await client.create_session_tool_call(
        session_id=session_id,
        tool_name="search",
        tool_input={"query": "latest news"},
        tool_output={"results": [...]},
    )
    await client.create_session_artifact(
        session_id=session_id,
        artifact_name="output",
        artifact="...",
    )
    await client.end_session(session_id, success=True)
```

## Configuration

| Parameter | Environment variable | Default |
|-----------|---------------------|---------|
| `api_key` | `INFLUXION_API_KEY` | — (required) |
| `base_url` | `INFLUXION_BASE_URL` | `https://api.influxion.io/v1` |
| `fail_silently` | — | `True` |

`fail_silently=True` (default): call-time errors are logged and methods return `None`
rather than raising. Set `fail_silently=False` during development to surface errors
immediately. `AuthenticationError` at construction always raises regardless.

## Running Tests

```bash
pip install -e ".[dev]"
pytest
```
