Skip to main content

AgentLoop

Find wasted work in AI agents. Verify each change.
Trace calls, inspect findings, and compare performance with your quality checks.

CI PyPI Downloads/month Python 3.10 or newer License: Apache-2.0

Quickstart · Why AgentLoop · Compare runs · Integrations · Guide

AgentLoop records model calls, tool calls, and retries in an agent workflow. Use its reports to inspect latency, token usage, and estimated model costs, find repeated work, and compare runs before and after a change.

Tracing and analysis run locally. You can work with JSON files without a database or hosted account. The dashboard and HTTP API are optional.

AgentLoop also profiles classifiers, rules and decision pipelines. See AI execution profiling for the trace-to-quality workflow and five offline reference examples in 0.1.0.

The Harbor and Omnigent interoperability workstream includes read-only Harbor ATIF and job/trial/verifier import, source-qualified native reports and pinned offline fixtures. Omnigent telemetry/session import preserves policy observations and coverage gaps. Task-paired cross-harness comparisons and behavior-verified capabilities are included in this release.

The bounded OTLP JSONL importer joins split telemetry traces and keeps duplicate/conflicting records, conversion losses and inferred timing explicit. It works offline without upstream runtimes or OpenTelemetry packages.

The capability registry lists explicit adapter declarations and distinguishes current probe evidence from unknown/skipped capabilities. Inspection does not enable runtime controls.

Run the offline capability bench to check actual wrapped behavior, source counters and declaration drift. Missing SDKs and live-only features remain explicit skips.

The cross-harness cohort workflow compares completed Harbor jobs with exact task pairing and independent verifier criteria, while retaining failed, missing and unpaired attempts in population reports.

Coordination reports preserve distinct child documents, observed interval overlap and usage attribution, with explicit gaps for missing children, caller wait, duplicate-work inputs and review quality.

The offline adoption guide connects the copyable examples, source/quality limits, complete inventories and validation workflow. These integrations are Unreleased checkout capabilities.

Without and with AgentLoop

Architecture comparison: your agent feeds custom timing, usage parsing, retry analysis, output checks, and report code without AgentLoop. With AgentLoop, the same execution evidence feeds a shared tracing, analysis, and replay workflow.
Read the comparison in text
Question Without AgentLoop With AgentLoop
Where did the time go? Add timers and connect logs to calls. Inspect recorded model, tool, and retry spans.
What should I investigate? Look through calls and logs for repeated work. Follow findings to affected spans and suggested changes.
Did the change help? Write your own before/after comparison. Compare saved runs with agentloop replay.
Is the output still acceptable? Combine task-specific checks with the performance comparison. Supply quality fixtures and evaluate them alongside performance gates.

AgentLoop supplies the tracing and comparison workflow. You choose the change, define what a correct output looks like, and decide which checks must pass.

How AgentLoop fits your stack

Architecture: your application runs the agent and calls models and tools. AgentLoop decorators and adapters record spans into trace JSON. Analyze produces metrics and findings; replay compares a candidate with its baseline and your quality fixtures. Both produce reports for review or CI.

Your application runs the agent and chooses its framework and models. AgentLoop's decorators and adapters record the instrumented calls. Exported traces feed analysis, baseline/candidate replay, and reports for review or CI.

When you change the framework, model, prompt, or execution strategy, record the same task again. Compare both runs with the same quality fixtures to check the effect of your change.

Quickstart

Requires Python 3.10 or newer:

python -m pip install agentloop-profiler
agentloop quickstart

The package name is agentloop-profiler; the Python import and CLI command are both agentloop.

quickstart creates runs/agentloop_quickstart.json and prints findings from synthetic data. Use it to check the installation and learn the report format. The demo itself makes no network or model API calls.

Inspect the saved trace and export the complete analysis:

agentloop analyze runs/agentloop_quickstart.json --json-out runs/quickstart_analysis.json

The analysis JSON contains the trace, its metrics, findings, and optimization suggestions. See First useful result for more options.

Add --html runs/report.html to analyze for a single offline report with a timeline and linked finding evidence. See HTML reports.

Record your own run

Save this complete example as example_agent.py. It traces a few local function calls so you can try instrumentation without a model SDK or API key. Replace the function body with your own work when adapting it to an agent.

import agentloop

NOTES = {
    "tracing": "Record the steps in a workflow.",
    "optimization": "Investigate repeated or expensive work.",
    "replay": "Compare saved baseline and candidate traces.",
}


@agentloop.trace_tool(name="lookup_note")
def lookup_note(topic: str) -> str:
    return NOTES[topic]


with agentloop.trace_agent("research_agent") as trace:
    output = {"notes": [lookup_note(topic) for topic in NOTES]}
    trace.metadata["output"] = output

trace.export_json("runs/research_agent.json")
print(output)

Run it, then analyze the file it created:

python example_agent.py
agentloop analyze runs/research_agent.json --json-out runs/research_agent_analysis.json

The decorator records each function call's duration and status. The example also explicitly saves the final output in trace metadata so the quality checks below can read it. Decide which outputs are appropriate to retain when adapting this example to real data.

For model calls, use an SDK integration to capture provider token usage. The integration guide also covers model decorators, context managers, streaming, and cancellation.

Inspect findings

Start with analyze. It combines metrics, findings, and proposed optimizations in one report. AgentLoop looks for patterns such as repeated context, retry loops, repeated model calls, large steps, and recurring tool calls.

On main, reports and optimization use the same versioned finding rules. If a rule fails, its diagnostics remain visible and analysis is marked incomplete. CI requires complete analysis before recommending a merge.

Treat a suggestion as a change to investigate. For example, repeated tool names alone do not establish that calls are safe to run concurrently. The development version on main exposes the evidence and assumptions behind parallelization candidates.

Use individual commands when you need a specific artifact:

Command Output
agentloop report runs/research_agent.json Metrics for one run.
agentloop diagnose --path runs/research_agent.json Findings with affected spans and validation criteria.
agentloop optimize --path runs/research_agent.json Suggested changes and estimated savings.
agentloop patch --path runs/research_agent.json --repo . Proposed edits for the repository at ., ready for you to review and apply.

Change one thing at a time, such as reducing repeated context or changing a retry policy, so you can attribute the result to that change.

Compare before and after

Run your agent before the change and export runs/baseline.json. Run the changed agent on the same task and export runs/candidate.json. replay compares these saved traces:

agentloop replay --baseline runs/baseline.json --candidate runs/candidate.json --min-latency-improvement-pct 10

This requires at least a 10% latency improvement. The report also compares costs, tokens, retries, and call counts. It writes runs/replay_report.md and exits nonzero when a required gate fails. Use agentloop replay --help to choose other thresholds or a JSON output path.

A result applies to the runs and checks you supplied. Repeat the comparison across representative tasks before drawing broader conclusions. Add output checks when you need evidence that the changed agent still meets its task requirements.

Quality gates

Quality fixtures define checks against the recorded output. For the example above, save this as fixtures.json:

{
  "fixtures": [
    {
      "id": "notes_present",
      "scorer": {"type": "required_fields", "required": ["notes"]}
    }
  ]
}

Run the check against the example trace:

agentloop quality-report fixtures.json --candidate runs/research_agent.json

This checks that the final output has a nonempty notes field. Choose expectations that express correctness for your own task. Fixtures can provide outputs directly or use a trace's metadata.output; the scorer can also use the last model call's recorded output text when available.

Scorer Check
exact_match Output exactly matches an expected value, including its type.
contains Output contains specified text.
glob Output matches a bounded wildcard pattern.
required_fields A JSON object contains the specified nonempty fields.
json_subset A JSON object contains specified top-level keys with matching values.
custom A trusted local Python function, configured as module:function, scores the output.

Every candidate case must pass. If you set --min-quality-score in replay/ci (or --min-score in quality-report), the average score must also meet that threshold. Invalid suites fail closed.

Custom scorers run Python code and should be used only with trusted local fixtures. The HTTP endpoint rejects them. See the changelog for regex and json_schema migration notes.

Once you have baseline and candidate traces, use the same fixtures in CI:

agentloop ci --baseline runs/baseline.json --candidate runs/candidate.json --quality-fixtures fixtures.json

ci writes a Markdown report suitable for a pull request and exits nonzero when a required gate fails. It evaluates the traces your application supplies.

The repository's required replay check uses synthetic demos to test AgentLoop's CI machinery. For comparisons using your application's artifacts, see CI self-tests and application comparisons.

Understand the results

These notes describe the current main branch. Check Unreleased changes for behavior that has not yet shipped in the published package.

Result How to interpret it
Runtime and call counts Recorded execution data. total_runtime_ms is elapsed time; cumulative_span_time_ms sums spans and can be larger when calls overlap or nest.
Operation kinds Agent, workflow, model, tool, retrieval, and other roles recorded alongside legacy event categories. See Operation kinds.
Token counts Counts identify their source: a provider, a tokenizer, user code, or a word-count estimate. Missing usage is marked unavailable.
Model cost A calculation from token counts and configured pricing. Unknown prices or estimated usage limit the comparisons you can make.
Optimization savings Uncalibrated predictions with versioned formulas, coefficients, and assumptions. Measure a candidate run to establish the actual effect.
Quality scores Results of the checks you supplied. Their coverage depends on your fixtures.

Cost gates can be marked indeterminate when pricing or usable token counts are missing. An indeterminate cost comparison does not fail the default gate; requiring a positive --min-cost-improvement-pct makes unverifiable cost improvement fail. See Pricing and Trace compatibility for the details, including how older traces are handled.

The optimizer avoids double-counting suggestions that affect the same spans. Reports say whether the chosen combination is exact or approximate. See Savings selection. For individual predictions, see Estimator provenance. The intervention ledger links finding predictions to measured candidate results and preserves quality checks in an exportable record. For experiments across tasks and repetitions, use paired study summaries.

Keep your Markdown renderer's safe mode or HTML sanitizer enabled when viewing reports from untrusted traces.

Framework integrations

For existing telemetry, OTLP conformance covers GenAI, OpenInference, and MCP JSON, including operation kinds and evidence metadata. From an unreleased source checkout, standards-first onboarding validates existing telemetry before analysis and provides one explicit SDK instrumentation entrypoint with documented coverage and measured local overhead.

Integration How it connects
Custom Python agents Decorators and context managers around your functions.
OpenAI SDK Wrap a client or callable to capture calls, streams, and reported usage.
OpenAI Agents SDK Attach an AgentLoop tracing processor.
LangGraph Instrument the builder before adding nodes, then wrap the compiled runnable.
CrewAI Wrap crew, task, or agent execution methods.
OpenTelemetry / Vercel AI SDK telemetry Import supported telemetry into AgentLoop traces.

The adapters are included in AgentLoop. Install the framework's own SDK separately when needed; python -m pip install "agentloop-profiler[instrumentation]" includes the OpenAI Python SDK. See Framework integrations for setup and supported behavior.

Dashboard and persistence

The dashboard reads stored traces. From a source checkout, load the synthetic example and start Streamlit:

uv run --frozen --all-extras agentloop quickstart
uv run --frozen --all-extras agentloop store-trace --path runs/agentloop_quickstart.json --project-id default
uv run --frozen --all-extras streamlit run dashboard/app.py

Open the URL printed by Streamlit and leave the sidebar's Project field set to default. To inspect your own data, store your trace file with store-trace.

AgentLoop uses SQLite by default and supports Postgres for shared storage. The optional HTTP API accepts traces and serves project-scoped reports and findings. Application endpoints use /v1. Existing unversioned aliases remain available throughout 0.x; see API versioning for the migration path. See Dashboard setup and Production deployment for database configuration, API authentication, and deployment instructions.

Other installation options

Source checkout

Use a source checkout for the dashboard or the latest unreleased changes. Install uv, then run:

git clone https://github.com/dipeshbabu/agentloop.git
cd agentloop
uv sync --locked --all-extras
uv run --frozen --all-extras agentloop quickstart

Standalone CLI

The GitHub Releases page has executables for Linux x86-64, Windows x86-64, macOS Intel, and macOS Apple silicon. They bundle Python and the core CLI. Use the Python package for SDK instrumentation, the dashboard, API server, or Postgres support.

Use the downloaded executable wherever the examples show agentloop.

Download and verify a standalone executable

Download the matching file and SHA256SUMS from the same release. Replace X.Y.Z with its version number.

Linux (Bash):

set -euo pipefail
version=X.Y.Z
asset="agentloop-v${version}-linux-x86_64"
curl -LO "https://github.com/dipeshbabu/agentloop/releases/download/v${version}/${asset}"
curl -LO "https://github.com/dipeshbabu/agentloop/releases/download/v${version}/SHA256SUMS"
mapfile -t checksum_lines < <(awk -v asset="$asset" '$2 == asset { print }' SHA256SUMS)
if [ "${#checksum_lines[@]}" -ne 1 ]; then
  echo "Expected exactly one checksum for ${asset}" >&2
  exit 1
fi
printf '%s\n' "${checksum_lines[0]}" | sha256sum --check --strict
chmod +x "$asset"
./"$asset" --help

Windows PowerShell:

$Version = "X.Y.Z"
$Asset = "agentloop-v$Version-windows-x86_64.exe"
Invoke-WebRequest "https://github.com/dipeshbabu/agentloop/releases/download/v$Version/$Asset" -OutFile agentloop.exe
Invoke-WebRequest "https://github.com/dipeshbabu/agentloop/releases/download/v$Version/SHA256SUMS" -OutFile SHA256SUMS
$ChecksumLines = @(Get-Content SHA256SUMS | Where-Object {
    $_ -match "^[0-9a-fA-F]{64}  $([regex]::Escape($Asset))$"
})
if ($ChecksumLines.Count -ne 1) { throw "Expected exactly one checksum for $Asset" }
$ExpectedHash = ($ChecksumLines[0] -split "  ", 2)[0]
$ActualHash = (Get-FileHash .\agentloop.exe -Algorithm SHA256).Hash
if ($ActualHash -ne $ExpectedHash) { throw "Checksum verification failed for $Asset" }
.\agentloop.exe --help

Each release includes platform-specific third-party notices. macOS executables are ad-hoc signed but not notarized; Gatekeeper may require approval on first launch.

Research use

For experiments, record one trace per task attempt and condition. Attach metadata such as task ID, seed, model, and source commit, and repeat comparisons across your task set. The research guide explains this workflow. From a source checkout, run the offline paired example with:

uv run --frozen --all-extras python examples/research_experiment_demo.py

Help and contributions

Run agentloop --help for all commands, or agentloop COMMAND --help for a specific command. Use agentloop doctor to inspect your installation and available integrations.

AgentLoop is under active pre-1.0 development. Use a tagged release when you need a fixed version, and check the changelog before upgrading. Maintainers can use the launch checklist when preparing a public release.

License

Copyright 2026 Dipesh Tharu Mahato.

AgentLoop is licensed under the Apache License 2.0. Dependencies retain their own terms; see THIRD_PARTY_LICENSES.md.

Metadata

Release files for agentloop-profiler 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentloop-profiler 0.1.0
File Size Uploaded
agentloop_profiler-0.1.0.tar.gz 750.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentloop-profiler 0.1.0
File Interpreter ABI Platform
agentloop_profiler-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / agentloop_profiler-0.1.0.tar.gz

Download URL agentloop_profiler-0.1.0.tar.gz
Size 750.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d77f61ed6a84c811b2ba989ab7285adad88518ebf6a7ac0bcadb80e93cc2ae93
BLAKE2b-256 checksum
How to use checksums
373af06956aad821917ca570ce115687e29d1358b083e6b2a7c3bbbd53cd06d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / agentloop_profiler-0.1.0-py3-none-any.whl

Download URL agentloop_profiler-0.1.0-py3-none-any.whl
Size 536.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85109c638b319dd41a73cd8f3550ece16b4fb0ed4d471db76f18d0f7fa7f06e7
BLAKE2b-256 checksum
How to use checksums
fcb1dcc69a15f13e1d60fdc60419ffca992ad19a997f1384b50d34561a488b4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page