Metadata-Version: 2.4
Name: trace-agent-sdk
Version: 0.0.2
Summary: TraceAgent SDK for instrumenting AI agents.
Author-email: Enrique Javier Villar Cea <villarcea.enriquejavier@gmail.com>, Javier Rodriguez Castellano <javirodriguezcastellano@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/LixusSoftware/TraceAgent
Project-URL: Repository, https://github.com/LixusSoftware/TraceAgent
Project-URL: Issues, https://github.com/LixusSoftware/TraceAgent/issues
Keywords: agent,observability,tracing,llm,tools
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.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: httpx<1.0.0,>=0.27.0
Requires-Dist: pydantic<3.0.0,>=2.8.0
Provides-Extra: dev
Requires-Dist: pytest<9.0.0,>=8.3.2; extra == "dev"

# TraceAgent SDK

![GitHub Release](https://img.shields.io/github/v/release/LixusSoftware/TraceAgent)
![GitHub Stars](https://img.shields.io/github/stars/LixusSoftware/TraceAgent)
![GitHub License](https://img.shields.io/github/license/LixusSoftware/TraceAgent)
![Tests](https://github.com/LixusSoftware/TraceAgent/actions/workflows/test.yml/badge.svg)

Python SDK for instrumenting AI agents and streaming events to a TraceAgent backend.

## Install

```bash
pip install trace-agent-sdk
```

## Usage

```python
from trace_agent_sdk import TraceAgentClient

client = TraceAgentClient("http://localhost:8000")
run = client.start_run("my-agent", "Do something")


@run.tool()
def search(query: str) -> str:
    return f"Results for {query}"


result = run.create_model_turn(
    messages=[{"role": "user", "content": "Search for Python"}],
    model="gpt-4",
)

run.finish()
```

## File and command wrappers

```python
# Record a command execution
run.commands.run(["python", "-m", "pytest"], cwd="./my-project")

# Record file operations
run.files.read_text("config.yaml")
run.files.write_text("output.txt", "hello world")
run.files.patch_text("app.py", "print('fixed')\n")
```

## License

MIT
