Skip to main content

Semantic side-effect tracking for AI agents

Project description

effect-log

Semantic side-effect tracking for AI agents.

When an AI agent crashes mid-task, what happens on restart? Without effect-log, irreversible actions (emails, payments, deployments) get repeated. With effect-log, the system knows what completed and what didn't — it returns sealed results for finished work and resumes from where it left off.

The Core Idea

Every tool declares its effect kind at registration time. This drives all recovery behavior:

EffectKind Recovery (completed) Recovery (crashed)
ReadOnly Replay for fresh data Replay safely
IdempotentWrite Return sealed result Replay with same key
Compensatable Return sealed result Compensate, then replay
IrreversibleWrite Return sealed result Escalate to human
ReadThenWrite Return sealed result Escalate to human

Quick Start

from effect_log import EffectKind, EffectLog, ToolDef

def send_email(args):
    return smtp.send(args["to"], args["subject"], args["body"])

tools = [
    ToolDef("read_file",  EffectKind.ReadOnly,         read_file),
    ToolDef("send_email", EffectKind.IrreversibleWrite, send_email),
    ToolDef("upsert",     EffectKind.IdempotentWrite,   upsert_record),
]

log = EffectLog(execution_id="task-001", tools=tools, storage="sqlite:///effects.db")
log.execute("read_file",  {"path": "/tmp/report.csv"})
log.execute("send_email", {"to": "ceo@co.com", "subject": "Report", "body": "..."})
log.execute("upsert",     {"id": "report-001", "data": data})

Recovery — just add recover=True, re-run the same steps:

log = EffectLog(execution_id="task-001", tools=tools, storage="sqlite:///effects.db", recover=True)
log.execute("read_file",  {"path": "/tmp/report.csv"})  # Replayed (fresh data)
log.execute("send_email", {"to": "ceo@co.com", ...})    # Sealed — NOT re-sent
log.execute("upsert",     {"id": "report-001", ...})    # Replayed (idempotent)

Framework Integration

Built-in middleware for major agent frameworks:

Framework Middleware Entry Point
LangGraph effect_log.middleware.langgraph EffectLogToolNode, effect_logged_tools
OpenAI Agents SDK effect_log.middleware.openai_agents effect_logged_agent, wrap_function_tool
CrewAI effect_log.middleware.crewai effect_logged_crew, effect_logged_tool

See examples/ for runnable demos:

How It Works

A write-ahead log with two record types:

  1. Intent — written before execution (tool name, effect kind, input, cursor)
  2. Completion — written after execution (outcome, sealed response)

Intent without completion = crash detected. The recovery engine uses the effect kind to decide: replay, return sealed, compensate, or escalate.

Building from Source

# Rust
cargo build --release
cargo test --workspace --all-features

# Python
cd bindings/python
pip install maturin
maturin develop --all-features
pytest tests/ -v

Roadmap

  • Core library — WAL engine, recovery engine, SQLite + in-memory backends
  • Python bindings — PyO3 + maturin
  • Framework middleware — LangGraph, OpenAI Agents SDK, CrewAI
  • TypeScript bindings — napi-rs, Vercel AI SDK
  • Additional backends — RocksDB, S3, Restate journal
  • Auto-classification — infer effect kind from HTTP methods / API metadata

Inspiration

The idea behind this project was inspired by a blog post from Guanlan Dai. He introduced the concepts of effect log and semantic correctness.

License

Apache-2.0

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

ai_effectlog-0.1.0.tar.gz (41.4 kB view details)

Uploaded Source

Built Distributions

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

ai_effectlog-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

ai_effectlog-0.1.0-cp312-cp312-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.12Windows x86-64

ai_effectlog-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

ai_effectlog-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ai_effectlog-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

ai_effectlog-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

ai_effectlog-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

ai_effectlog-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

ai_effectlog-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file ai_effectlog-0.1.0.tar.gz.

File metadata

  • Download URL: ai_effectlog-0.1.0.tar.gz
  • Upload date:
  • Size: 41.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ai_effectlog-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3fe20c1c633b070ef3e573b95a1260be68fb398e6473a9201ac21f48727172b7
MD5 f3a2ee655a9fbaeec53b5bf87b874264
BLAKE2b-256 1b53ac072b5d0d99625d8dce9dee7111a70f22668d5deb987ee6acbd0538ea67

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_effectlog-0.1.0.tar.gz:

Publisher: release.yml on xudong963/effect-log

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_effectlog-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ai_effectlog-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2383ee19431e3da47113cfdf56dfc52d2856e0265e1588f98fed7a1e34415fc0
MD5 df78a5a255507a7ed12ace355dbffd3c
BLAKE2b-256 8195378d9fedbe37229380d3a200be401255a54d8e48ed04f58d297672ab08d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_effectlog-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on xudong963/effect-log

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_effectlog-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for ai_effectlog-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 66a5e203c4a4ade8d58ddbbadd37c2fc0f64919238b766e67dadf372e7dd9ddb
MD5 719d9cb66c64a20e720ba7310537b003
BLAKE2b-256 4d251eadff93db93e8c424f088b2dedcaf8d08a46f3e9d7abfb4a4ca9476f52a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_effectlog-0.1.0-cp312-cp312-win_amd64.whl:

Publisher: release.yml on xudong963/effect-log

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_effectlog-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ai_effectlog-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 655b2e73f8ef6a75eb9ad810fc7aa474d65c030ca6654e2c8020049c35c6e0e3
MD5 45ada262505d4f1fb7b714462aa32ac2
BLAKE2b-256 0ca18333d628a7bb4d8cc3af8ae8de93326e1a148d082841ec939d460cbbf038

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_effectlog-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on xudong963/effect-log

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_effectlog-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ai_effectlog-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3a126a3e28371e393030eb1bec6bb8e7eef0aa699f2bd703a893553af29bb97f
MD5 c178fa89feab7ffb9cb609d7456f28b0
BLAKE2b-256 4fb556a727c1616152dd831f36d802d3aa0757d777e2c5fd94a369fe5a6c7f8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_effectlog-0.1.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on xudong963/effect-log

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_effectlog-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ai_effectlog-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 66bc7136a71db1f989762b6e04f881882f8ec2ef9ee4136a1be0bc22c0da3a62
MD5 8beb8e56e7776b82fc0b10286c873418
BLAKE2b-256 60b8e1fe1390f5c2cd09ffdd12229764065f68c10e8b11b313e91867bd8f8341

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_effectlog-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: release.yml on xudong963/effect-log

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_effectlog-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ai_effectlog-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 82fbe4483409a74d0b9fd9da508bc6b42b58588fe2f7b48e1c0beae879426990
MD5 15c77b71190724969ecce94a72840646
BLAKE2b-256 ef4f26130f8db5abaa21317fcce48d5cb2f21cbb8037c626c03468401b1b950d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_effectlog-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on xudong963/effect-log

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_effectlog-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ai_effectlog-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d80f418a0fba704a80fa1e4a73c8aa4e3ccd4e018ff2076f2665bd1ca38c1ae2
MD5 f24294b4d2b1aeacc9eb00d5e4ee663f
BLAKE2b-256 986b3183824ffba0004512cd4824d9ed367bf9741bb63da21ecae55db7ace305

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_effectlog-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on xudong963/effect-log

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_effectlog-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ai_effectlog-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1a1dd708ed74de3cf4eacc97286f48a5c83deca50d151761440ab2e5f104471d
MD5 193e9591b6734f055e683121ee4fe116
BLAKE2b-256 9e6a82f4a8c2d1f4987fcee43e18f54ab4c465f1694587909e57c44769d91cd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_effectlog-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on xudong963/effect-log

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_effectlog-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ai_effectlog-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 33f689768483d3ddffff1d25ac25abce06354948fc18cae9886d12103db42e5d
MD5 83680e0d417c50ad32618cfa53548f81
BLAKE2b-256 d2c7712a7ddc39b357b8c570b0cb205b3c34cf0159a6cd2c3ab4d2ee9815d530

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_effectlog-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on xudong963/effect-log

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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