Metadata-Version: 2.4
Name: tei-loop
Version: 0.3.1
Summary: Target, Evaluate, Improve: A self-improving loop for agentic systems
Author-email: Orkhan Javadli <ojavadli@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/ojavadli/tei-loop
Project-URL: Repository, https://github.com/ojavadli/tei-loop
Keywords: agents,evaluation,improvement,llm,agentic-systems,self-improving
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.0
Provides-Extra: openai
Requires-Dist: openai>=1.40; extra == "openai"
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.34; extra == "anthropic"
Provides-Extra: google
Requires-Dist: google-generativeai>=0.8; extra == "google"
Provides-Extra: all
Requires-Dist: openai>=1.40; extra == "all"
Requires-Dist: anthropic>=0.34; extra == "all"
Requires-Dist: google-generativeai>=0.8; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
Requires-Dist: ruff>=0.5; extra == "dev"
Dynamic: license-file

# TEI Loop

**Target, Evaluate, Improve** — a self-improving loop for agentic systems.

## Get Started

```bash
pip install tei-loop
```

```bash
python3 -m tei_loop your_agent.py
```

TEI does the rest:
- Finds your agent function automatically
- Generates a test query automatically
- Evaluates across 4 dimensions
- Applies targeted improvements
- Saves results to `tei-results/` folder (created next to your agent file)

> If `pip` is not found, use `pip3` instead.

## What TEI Creates

```
your_project/
  your_agent.py
  tei-results/           <-- created automatically
    run_20260218_071500.json
    latest.json
```

## Options

```bash
python3 -m tei_loop agent.py                             # Auto everything
python3 -m tei_loop agent.py --function my_func          # Pick specific function
python3 -m tei_loop agent.py --query "custom input"      # Custom test query
python3 -m tei_loop agent.py --retries 5                 # More improvement cycles
python3 -m tei_loop agent.py --verbose                   # Detailed output
```

## Python API

```python
import asyncio
from tei_loop import TEILoop

def my_agent(query: str) -> str:
    return result

async def main():
    loop = TEILoop(agent=my_agent)
    result = await loop.run("test query")
    print(result.summary())

asyncio.run(main())
```

## 4 Evaluation Dimensions

| Dimension | What it checks |
|---|---|
| **Target Alignment** | Did the agent pursue the correct objective? |
| **Reasoning Soundness** | Was the reasoning logical? |
| **Execution Accuracy** | Were tools called correctly? |
| **Output Integrity** | Is the output complete and accurate? |

## Two Modes

**Runtime** (default): Per-query improvement in seconds.

**Development**: Across many queries, permanent prompt improvements.

```python
results = await loop.develop(queries=[...], max_iterations=50)
```

## Works With Any Agent

Any Python callable. No framework lock-in: LangGraph, CrewAI, custom Python, FastAPI, anything.

## License

MIT
