Skip to main content

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 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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tei_loop-0.2.2.tar.gz (38.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tei_loop-0.2.2-py3-none-any.whl (49.5 kB view details)

Uploaded Python 3

File details

Details for the file tei_loop-0.2.2.tar.gz.

File metadata

  • Download URL: tei_loop-0.2.2.tar.gz
  • Upload date:
  • Size: 38.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for tei_loop-0.2.2.tar.gz
Algorithm Hash digest
SHA256 1a4dfe76d62e840a245c68a72afeb72052df689baae2c8d68cc9e0dca3859009
MD5 9b74f558773de4c2781c148111a36a76
BLAKE2b-256 e8140c322a3b10669c2cdb6ae85a177bc93673852eda29ee897caabf9b3428e1

See more details on using hashes here.

File details

Details for the file tei_loop-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: tei_loop-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 49.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for tei_loop-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 089314473cdfa31df8b125b5658614cbb42f1013f77f205b022cdcb7b8047d9e
MD5 04a0ebd016ac6524eec2aecd81605ecd
BLAKE2b-256 3137244e34c5481baa223b8cb9636c0f7b1e0af8db6fec3985a494523ebce7a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page