Metadata-Version: 2.4
Name: testbench-ai-service
Version: 1.0.0
Summary: REST API service supporting multiple AI agents for imbus TestBench
Keywords: testbench,ai-proxy,artificial-intelligence,llm,openai,test-automation,test-case-review,test-case-generation,defect-explanation,fastapi,proxy-server
Author-email: imbus AG <support@imbus.de>
Requires-Python: >=3.10,<3.15
Description-Content-Type: text/markdown
Classifier: Environment :: Console
Classifier: Environment :: Web Environment
Classifier: Framework :: AsyncIO
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
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 :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Quality Assurance
License-File: LICENSE
Requires-Dist: fastapi>=0.135.2,<1.0.0
Requires-Dist: pydantic>=2.12.5,<3.0.0
Requires-Dist: uvicorn>=0.42.0,<1.0.0
Requires-Dist: python-dotenv>=1.2.2,<2.0.0
Requires-Dist: openai>=2.30.0,<3.0.0
Requires-Dist: anthropic>=0.97.0,<1.0.0
Requires-Dist: PyYAML>=6.0.3,<7.0.0
Requires-Dist: jinja2>=3.1.6,<4.0.0
Requires-Dist: testbench-cli-reporter>=3.0.0rc4
Requires-Dist: testbench2robotframework>=0.9.2b5
Requires-Dist: requests>=2.33.1,<3.0.0
Requires-Dist: tzdata>=2025.3
Requires-Dist: tomli>=2.4.1,<3.0.0
Requires-Dist: tomli-w>=1.2.0,<2.0.0
Requires-Dist: jsonschema>=4.26.0,<5.0.0
Requires-Dist: PyJWT>=2.12.1,<3.0.0
Requires-Dist: ruff>=0.15.8 ; extra == "dev"
Requires-Dist: mypy>=1.20.0 ; extra == "dev"
Requires-Dist: types-requests>=2.32.0 ; extra == "dev"
Requires-Dist: types-PyYAML>=6.0.0 ; extra == "dev"
Requires-Dist: types-jsonschema>=4.26.0 ; extra == "dev"
Requires-Dist: types-pyinstaller>=6.19.0 ; extra == "dev"
Requires-Dist: pre-commit>=4.5.1 ; extra == "dev"
Requires-Dist: flit>=3.12.0 ; extra == "dev"
Requires-Dist: wheel>=0.46.3 ; extra == "dev"
Requires-Dist: pytest>=9.0.2 ; extra == "dev"
Requires-Dist: pytest-asyncio>=1.3.0 ; extra == "dev"
Requires-Dist: pytest-mock>=3.15.1 ; extra == "dev"
Project-URL: Changelog, https://github.com/imbus/testbench-ai-service/blob/main/CHANGELOG.md
Project-URL: Documentation, https://imbus.github.io/testbench-ecosystem-documentation/testbench-ai-service/intro
Project-URL: Homepage, https://github.com/imbus/testbench-ai-service
Project-URL: Source, https://github.com/imbus/testbench-ai-service
Provides-Extra: dev

# TestBench AI Service

[![PyPI version](https://img.shields.io/pypi/v/testbench-ai-service.svg)](https://pypi.org/project/testbench-ai-service/)
[![Python versions](https://img.shields.io/pypi/pyversions/testbench-ai-service.svg)](https://pypi.org/project/testbench-ai-service/)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/imbus/testbench-ai-service/blob/main/LICENSE)

An asynchronous REST API service that connects [imbus TestBench](https://www.testbench.com) to external LLM providers to support AI-driven Agents during test design and execution.

## Features

- **Multiple Agents:** test case set reviews, description generation, and defect explanations, each configurable independently
- **Pluggable LLM providers:** ships with OpenAI, Azure OpenAI, and Anthropic support; implement a custom `LLMClient` to bring your own
- **Automatic provider routing:** model names starting with `gpt-*` and o-series (`o1`, `o3`, `o4-mini`, …) are routed to OpenAI, `claude-*` to Anthropic — regardless of the global provider setting
- **Configurable prompts:** YAML-based templates with Jinja2 variables and per-project overrides
- **Per-project configuration:** language, LLM provider, prompt variant, and enabled agents can be overridden per TestBench project
- **Localization:** built-in English and German translations for AI-generated output
- **JWT authentication:** every request is validated against the TestBench REST API using a JWT token; no separate credential management
- **Async processing:** Agents run as background tasks so the API responds immediately
- **Swagger UI:** interactive API docs at `/docs`
- **SSL/TLS & reverse proxy support:** optional HTTPS with mTLS and trusted-proxy headers

## Installation

**With pip** (Python 3.10–3.14 required):

```bash
pip install testbench-ai-service
```

**Standalone executable** (no Python required): download the pre-built binary from the [GitHub releases page](https://github.com/imbus/testbench-ai-service/releases).

## Quick Start

**1. Set your LLM API key**

Create a `.env` file in the installation directory with the key for your chosen provider:

```bash
# .env
# OpenAI
OPENAI_API_KEY=your_openai_api_key

# Azure OpenAI
# AZURE_OPENAI_API_KEY=your_azure_openai_api_key

# Anthropic
# ANTHROPIC_API_KEY=your_anthropic_api_key
```

**2. Initialize configuration**

```bash
testbench-ai-service init
```

Open `config.toml` and point `tb_server_url` at your TestBench REST API:

```toml
[testbench-ai-service]
tb_server_url = "https://localhost:9443/api/"

[testbench-ai-service.llm_config]
# openai (default), azure_openai, anthropic, or custom
provider = "openai"
```

**3. Start the service**

```bash
testbench-ai-service start
```

The service runs at `http://127.0.0.1:8010` by default. Open `/docs` for the interactive Swagger UI.

## Documentation

Full documentation is available in the [docs/](https://github.com/imbus/testbench-ai-service/tree/main/docs) folder of the repository:

- [Introduction](https://github.com/imbus/testbench-ai-service/blob/main/docs/intro.md)
- [Installation](https://github.com/imbus/testbench-ai-service/blob/main/docs/getting-started/installation.md)
- [Quickstart](https://github.com/imbus/testbench-ai-service/blob/main/docs/getting-started/quickstart.md)
- [Configuration](https://github.com/imbus/testbench-ai-service/blob/main/docs/configuration.md)
- [Agents](https://github.com/imbus/testbench-ai-service/blob/main/docs/agents/index.md)
- [Prompts](https://github.com/imbus/testbench-ai-service/blob/main/docs/prompts.md)
- [TestBench Integration](https://github.com/imbus/testbench-ai-service/blob/main/docs/testbench-integration.md)
- [CLI Reference](https://github.com/imbus/testbench-ai-service/blob/main/docs/cli.md)

## Contributing

Contributions are welcome. See [CONTRIBUTING.md](https://github.com/imbus/testbench-ai-service/blob/main/CONTRIBUTING.md) for setup instructions and guidelines.

## Changelog

See [CHANGELOG.md](https://github.com/imbus/testbench-ai-service/blob/main/CHANGELOG.md) for release history.

## License

Apache 2.0. See [LICENSE](https://github.com/imbus/testbench-ai-service/blob/main/LICENSE) for details.
