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.1.7.tar.gz (36.2 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.1.7-py3-none-any.whl (47.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tei_loop-0.1.7.tar.gz
  • Upload date:
  • Size: 36.2 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.1.7.tar.gz
Algorithm Hash digest
SHA256 a558ccd1003ea04075ccd05150868f165a4c00ec69ea5137e9b70ae16cbc7cd5
MD5 372c024c742ee423ef579052aad015b7
BLAKE2b-256 5af000a9a582eb28cdc2441d592e3388de1782f0e0b064dc36f93c243c0d655b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tei_loop-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 47.2 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.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 eeefa38d01334bb1ea5e15db94f26c6be5d760e7e5321579f1d8aca58f6134be
MD5 5fbdf81ba04aa6a255905d43b532691a
BLAKE2b-256 a6642b57f451af6dfdad81ed57be5d9fd9f78c1dc79b66318c90a148b6804159

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