Target, Evaluate, Improve: A self-improving loop for agentic systems
Project description
TEI Loop
Target, Evaluate, Improve — a self-improving loop for agentic systems.
Get Started
pip install tei-loop
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
pipis not found, usepip3instead.
What TEI Creates
your_project/
your_agent.py
tei-results/ <-- created automatically
run_20260218_071500.json
latest.json
Options
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
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.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tei_loop-0.3.1.tar.gz.
File metadata
- Download URL: tei_loop-0.3.1.tar.gz
- Upload date:
- Size: 40.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a9cc647b6abd1b6a966b66104261ebab452b46a62366e0016b1f5772794052f
|
|
| MD5 |
cf2dbef88da4c4523ba2bc9afda7fcae
|
|
| BLAKE2b-256 |
03e7c18e95a26dfd4aac6c698d82fffae47dc98ce185402e37adbaf28c027ce4
|
File details
Details for the file tei_loop-0.3.1-py3-none-any.whl.
File metadata
- Download URL: tei_loop-0.3.1-py3-none-any.whl
- Upload date:
- Size: 52.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9577d0d46071807e0734dd214c726d1392b334f9fb4d2dc8f82016be287607c2
|
|
| MD5 |
dbe63b3fbe41bc8a0abf2584208f309c
|
|
| BLAKE2b-256 |
023ec56aff123862e6d0acaeaae70dacb0e2c0e5ab7d9473e617cb748b463cff
|