Metadata-Version: 2.4
Name: continua-sdk
Version: 0.1.0
Summary: Python SDK for Continua agent observability and debugging
Project-URL: Homepage, https://github.com/aryanVijaywargia/Continua
Project-URL: Repository, https://github.com/aryanVijaywargia/Continua
Project-URL: Documentation, https://github.com/aryanVijaywargia/Continua/tree/main/sdks/python
Project-URL: Issues, https://github.com/aryanVijaywargia/Continua/issues
Author: Continua AI
License: MIT License
        
        Copyright (c) 2024 Continua AI
        
        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,debugging,llm,observability,tracing
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx>=0.25.0
Requires-Dist: pydantic>=2.0.0
Description-Content-Type: text/markdown

# Continua SDK for Python

Python SDK for sending AI agent traces, spans, sessions, events, and engine control
requests to Continua.

## Installation

```bash
pip install continua-sdk
```

## Quick Start

Initialize the client once at process startup:

```python
from continua import Continua, span, trace

Continua.init(
    api_key="your-api-key",
    endpoint="https://api.your-continua-host.com",
    ingest_mode="server_default",  # or "sync", "async_v2"
)


@trace(name="answer_question")
def answer_question(question: str) -> str:
    with span("retrieve_context", kind="tool") as s:
        s.set_input({"question": question})
        context = "retrieved context"
        s.set_output({"context": context})

    with span("call_model", kind="llm") as s:
        s.set_input({"question": question, "context": context})
        answer = "model answer"
        s.set_output({"answer": answer})
        return answer
```

For a local or self-hosted Continua server, point the SDK at your server URL:

```python
from continua import Continua

Continua.init(
    api_key="dev-api-key",
    endpoint="http://localhost:8080",
)
```

This package is the client library only. It sends data to a hosted or
self-hosted Continua server; it does not install or run the Go server,
Postgres, River workers, or debugger UI.

## Async Ingest Modes

- `server_default`: defer to the server rollout setting.
- `sync`: send `sync=true` and wait for inline processing.
- `async_v2`: opt into true async ingest with `X-Continua-Async-Version: 2`.

True async is not read-after-write. If your code needs the batch to be fully processed before it reads the ingested data back, use `ingest_mode="sync"` or poll with `wait_for_batch()`:

```python
result = client.wait_for_batch(batch_id, timeout=30, poll_interval=0.5)
```

## Development

```bash
# From sdks/python
uv sync

uv run pytest

uv run mypy src/

uv build
```

## Publishing

The Python package is published from this directory:

```bash
cd sdks/python
uv build
uv publish
```

Prefer PyPI Trusted Publishing in CI for repeatable releases once the project is
ready for public distribution.
