Agents that can prove their answers. reactifact is a Python runtime for typed, reactive agents: you declare artifacts and steps, the runtime derives the path — no graph to wire. Contracts, scenarios, evals, traces and replay are built in, local-first, with three core dependencies and no API key.
Your types are the graph. Your runs are the receipt.
Is: a Python library (3 core deps) · single-process · typed, versioned artifacts with provenance · deterministic replay · scenarios + evals + traces in the box · optional code-first knowledge base · runs offline, no API key Isn't: a managed platform · a distributed task queue · a pre-built agent/tool marketplace
The three things that matter
- No graph to draw.
@step(consumes=Question) -> Answeris the route. The runtime derives execution from which artifacts exist — fan-out, joins, retries and loops are state changes, not edges you maintain. - Proof, not logs. Every derived artifact links to its inputs, every answer carries the context hash, and a finished run replays deterministically. “Why did it say that?” is a query, not a guess.
- The whole loop is built in. Contracts, scenarios, dataset evals, traces, replay and branching live in the same runtime — no second stack for testing or observability.
Sixty seconds, no API key
uvx reactifact demo # or: uv add reactifact && uv run reactifact demo
uvx reactifact demo --web # browser: answer, provenance, contracts, traces
reactifact demo — computed, cited, reproducible
question What is the Q2 cloud spend variance, and does policy require approval?
sources transactions.csv (6 rows) · budget.csv (2 rows) · policy.md
answer Q2 cloud spend was $45,000 against a $40,000 budget (+12.5%) — exceeds
the 10% policy threshold. CFO approval is required before the quarter
is closed.
computed cloud spend $45,000 (2026-04 $12,000, 2026-05 $15,000, 2026-06 $18,000)
policy threshold 10% → approval required
citations budget.csv, transactions.csv, policy.md
provenance (context.related(answer.id, "supported_by"))
Answer → supported_by → Variance, policy.md
Variance → calculated_from → Spend, budget.csv
Spend → calculated_from → transactions.csv
context sha256 ffeca1bb18cbc34749d3b5bdb40d85677b1ac33d47fb1160f6c89053694b2783
re-run identical ✓
Three @step functions, none of which imports another by name: they declare
what they consume and produce, and the runtime derives the order from state.
The figures come from plain Python, and both the answer and the numbers carry
the hash of the exact state that produced them. The whole demo lives in
reactifact/demo.py.
demo --web serves the same run at / with the provenance graph, plus
/contracts, /traces, /api/demo and /docs. No API key, in-memory traces.
One pipeline, four surfaces
The same typed pipeline runs as a library, CLI, HTTP service, daemon or MCP tool. Web and MCP are adapters, not the core.
pipeline = Pipeline(steps=[...], seed_type=Question, answer_type=Answer, traces=True)
pipeline.run(seed) # library
app = pipeline.http() # /run, /stream, /docs, /contracts, /traces
| Surface | One line |
|---|---|
| CLI | reactifact run app:pipeline "hello" |
| HTTP | app = pipeline.http() — typed /run, SSE /stream, OpenAPI /docs |
| Daemon | Daemon(pipeline, seed_source=next_tick, interval=60).serve() |
| MCP | create_mcp_server([pipeline.as_tool()]) |
Need sessions and history? Chat(..., store="sessions.db").http() adds
/chat/stream plus /runs/{id}; pass ChatRoutes(invoke="/chat", history="/chat/history", clear="/chat/clear") for the DEVOPS-style paths.
HITL is just the next chat turn
Approval is a PendingQuestion, not a separate service. Ask from a step, let
Chat report waiting, and the next user message resumes the same pipeline:
from reactifact import Chat, Human, PendingQuestion, step
@step(consumes=Question, produces=PendingQuestion)
def approve(question: Question, human: Human) -> None:
human.ask("Deploy to production?", kind="approval")
chat = Chat(
steps=[approve, ...], # the rest of the pipeline continues after the answer
store="sessions.db",
seed_type=Question,
answer_type=Answer,
resume_pending=True, # "yes" answers the pending question
)
await chat.invoke("ship it") # {"waiting": True, "question": {...}}
await chat.invoke("yes") # same PendingQuestion resumed; pipeline continues
The message payload carries the structured question (id, kind, schema,
notes), and Chat.history shows a waiting: true message across reloads.
There is no /hitl endpoint: Chat.http() keeps the normal
/chat, /chat/stream and history contract, so the answer is just another turn.
Pipeline stays stateless; when it needs a person, wrap it in Chat.
For free-text answers, spread the ready approval flow instead of naming its internal steps:
from reactifact.recipes import ApprovalFlow
chat = Chat(
steps=[approve, *ApprovalFlow(steps=[deploy])],
...
)
ApprovalFlow includes a deterministic yes/no parser plus an optional LLM
fallback; ApprovalPolicy is the single place for custom prompts, few-shot
examples, domain vocabulary and the confidence threshold. ApprovalDecision
records policy_hash, and downstream code still checks
decision.allows(min_confidence=0.8) — ambiguity never auto-approves.
LLM calls are provider methods now: a step takes llm: LLMProvider and calls
await llm.structured(Schema, user=...) (or llm.reply, llm.structured_json,
llm.chat); context.resources.llm is still accepted by the old helpers.
Define a step, run it
from pydantic import BaseModel
from reactifact import Pipeline, step
class Question(BaseModel):
text: str
class Answer(BaseModel):
text: str
@step(consumes=Question) # produces=Answer inferred from ->
def answer(question: Question) -> Answer:
return Answer(text=f"you asked: {question.text}")
pipeline = Pipeline(steps=[answer], seed_type=Question, answer_type=Answer)
result = pipeline.run(Question(text="why did cloud spend jump in Q2?"))
print(result.latest(Answer).data.text)
print(result.sources(result.latest(Answer))) # citations, as a query
print(result.hash) # reproducible fingerprint
Pipeline owns steps, resources and defaults and builds a fresh Context +
Runtime per run. The CLI is the same pipeline:
reactifact run app:pipeline "why did cloud spend jump in Q2?"
run writes .reactifact/traces.db by default; reactifact trace renders the
latest run. Use --no-trace to skip it.
The loop is built in
Start with a contract, test the agent, gate a dataset, then inspect the run that actually happened:
| Stage | Built in |
|---|---|
| Design | pipeline.validate() / .describe(), contracts page, reactifact validate |
| Test | ScenarioLab, @scenario, tool faults, record/replay, check --scenarios |
| Evaluate | Dataset + deterministic metrics + LLM judge, check --evals, online eval |
| Observe | typed TraceStore, spans, reads/writes, provenance, /traces dashboard |
| Debug | reactifact trace, replay, branch, diff, context hashes |
One CI command:
reactifact check app.pipeline:pipeline \
--scenarios app.scenarios \
--evals evals/qa.json \
--overall 0.8
It runs contracts, scenarios and dataset evals in one gate and exits non-zero
when any stage fails. The same loop is available as code (pipeline.validate(),
ScenarioLab, evaluate) — the CLI is not a separate implementation.
What makes it different
| Traditional agent (LangGraph / CrewAI / LangChain) | reactifact |
|---|---|
| A program follows a graph / plan | Agents react to state changes |
| Messages and dicts | Typed, versioned artifacts (Claim, Evidence, Answer) |
| Orchestration is explicit wiring | Orchestration falls out of the state |
| A unit of work returns a change object | A step returns typed artifacts; the runtime compiles them |
| Retries/rollback are manual | Context is git-like versioned (diff, rollback, branch, merge) |
| “Who produced this?” is lost | Provenance links every derived artifact to its inputs |
| The model guesses the numbers | Calculations are calculated — the LLM reasons, Python computes |
| Tracing needs a SaaS add-on | Native trace store (SQLite + dashboard), exportable |
| Testing and evals need another stack | Scenarios + evals + traces + replay in one runtime |
| A web framework is the app | One pipeline, then CLI / HTTP / daemon / MCP adapters |
| Pulls in a framework's dependency tree | 3 core deps: pydantic, httpx, python-dotenv |
Full breakdown, including where reactifact is not the right choice: docs/en/comparison.md.
Who this is for
- Knowledge assistants over mixed sources. One question spans Confluence, a spreadsheet and a web page; the next spans a different subset. You declare what artifacts exist and what agents can do with them, and the runtime derives the path. Figures are computed, answers cite their sources, and a run replays to the same hash.
- Multi-step agents that don’t fit one graph. Search, verification, calculation, human approval and outbound actions compose by type; the next question can take a different subset without rewiring.
- Teams that need audit and regression gates. Typed contracts, scenarios, dataset evals, provenance and deterministic replay are first-class, not a bolt-on.
Not for a fixed A → B → C pipeline. There a plain function or LangGraph is shorter and just as correct.
Not a connector library or a managed platform. If you need dozens of
managed SaaS sources, LlamaIndex is the better tool. reactifact’s Source layer
is deliberately small and code-first: filesystem, CSV, embeddings, web, MCP.
Proof in the repo
examples/fintech_audit — a transactions CSV, a budget
CSV and a policy doc, no API key. The model never produces the number; plain
Python does, and the answer links to its evidence:
cloud spend: $45,000 (2026-04 $12k, 2026-05 $15k, 2026-06 $18k)
variance vs budget: +12.5% budget $40,000, policy threshold 10% → over
answer: Q2 cloud spend was $45,000 against a $40,000 budget (+12.5%) — ...
citations: budget.csv, transactions.csv, policy.md
audit: Answer —supported_by→ {Variance, Spend, Table, Policy}
context sha256: 24449f6f…
A harder, multi-source version — docs plus a CSV, computed sum, verified answer,
no key required — is examples/knowledge:
Two strategies explore on separate forks and merge cleanly; if they edit the
same artifact differently, reactifact raises MergeConflict instead of guessing:
Optional knowledge layer
If the agent needs a corpus, reactifact.knowledge is a code-first ingestion
layer — Connector → RawDocument → Document → Chunk → Index — with incremental
DocStore state, BM25 + RRF hybrid retrieval, ACL-aware reconcile, and
MemoryIndex / SqliteIndex / QdrantIndex / PgVectorIndex (plus optional
ChromaIndex). It reuses the core EmbeddingProvider; IndexSource /
IngestStep are the only bridges into Source / Step.
from reactifact.knowledge import KnowledgePipeline, SectionsChunker, SqliteIndex
pipeline = KnowledgePipeline(connector, chunker=SectionsChunker(), index=SqliteIndex(".reactifact/kb.db"))
await pipeline.run(incremental=True)
hits = await pipeline.query("how do I install it?", top_k=5, hybrid=True)
No YAML pipeline, CLI or plugin registry. See Knowledge base (or по-русски).
In the box
- Typed contracts —
@step,Consume,When,Wakes,Scope, joins and correlation;validate_contractscatches missing producers before a run. - Atomic state —
Contextwith git-like commits,diff,rollback,branch, three-waymerge; artifacts are versioned by content hash. - Provenance —
Answer —supported_by→ Claim —derived_from→ Evidence — extracted_from→ Doc; walk it withcontext.related(...). - HITL and outbox —
human.ask(...)→PendingQuestion;outbox.act(...)→PendingAction, delivered once after commit byRuntime(dispatcher=...). - Traces and replay — SQLite trace store + dashboard, portable
Markdown/HTML/JSON reports,
ReplayLLM, deterministiccontext_hash. - Scenarios and evals — seeded scenarios, tool/resource faults, record/replay, assertions, golden runs, dataset metrics, judges and CI gates.
- Budgets and lifecycle — hard
max_secondsdeadlines, stop at a generation boundary, readiness viaactive_runs()/in_flight. - Sessions and chat —
Chat+ChatAssistantwithSessionStore, SSE, history, memory policies, per-turn resources andChat.http(). - Transports — CLI, FastAPI (
/docs,/contracts,/traces), daemon, MCP both ways (create_mcp_server,mcp_stdio_tools,mcp_http_tools). - Agent Skills — bundled instructions for Claude Code, Cursor, Codex,
Copilot:
reactifact,reactifact-agents,reactifact-llm,reactifact-rag,reactifact-testing,reactifact-eval,reactifact-observability,reactifact-from-langchain.
Start here
Minimal agent, no web
uvx reactifact new agent my-agent
cd my-agent && uv sync
uv run reactifact run main:pipeline "hello"
uv run reactifact trace
Production HTTP shell
uvx reactifact new app my-app
cd my-app && uv sync --extra dev
cp .env.example .env
uv run reactifact dev
Existing project
uv add reactifact
uv run reactifact skills install # teach your coding agent the model
Then read Quickstart or Concepts.
Examples (in-repo, not shipped)
starter_app— copy-pasteable FastAPI app: structured call, RAG, tools, session chat.knowledge— multi-source chat: search → evidence → claim verification → answer, with CSV calculation.knowledge_base— real ingestion: connector → chunks → SQLite/Qdrant, incremental state, hybrid query.medic_lab— hypothesis laboratory: competing hypotheses scored, HITL steering, honest report.devops— HITL tool agents + LLM tool router + trace dashboard.code_review— deterministic-first diff review: rules + optional LLM findings → linked report.repair— budget-aware replanning (chat/data in Russian by design).chat— minimal offline single-model multi-turn conversation.forklab— deterministic branch & merge.fintech_audit— auditable, reproducible CSV answer with content hashes and provenance.approval_gate— HITL approval in one chat: ask, interpret free text, deploy only onApprovalDecision.allows().
Documentation
- English · Русский — concepts, sources, providers, recipes, patterns, observability, eval, branching, replay, viz/CLI, API.
- Quickstart — demo, CLI, HTTP, daemon and MCP in a few lines.
- Migrating — from LangGraph / CrewAI / LlamaIndex / plain Python: concept map, port-one-node, interop, checklist.
- Why reactifact — why the graph is derived rather than drawn, why determinism, why provenance.
- Comparison — reactifact vs LangGraph/CrewAI, feature by feature, and when not to use reactifact.
- docs/constitution.md — the design rationale and invariants.
- Roadmap — what’s next, and what’s deliberately out of scope.
Development
uv sync --extra dev --extra web
.venv/bin/python -m pytest
.venv/bin/mypy
.venv/bin/ruff check
npx --yes pyright
Status & contributing
Active, pre-1.0 — the API is stabilizing and 1.0 will freeze it (see the
roadmap); releases follow Keep a Changelog.
Questions and design discussion live in
GitHub Discussions; a star,
or a good first issue, helps more than you’d think.
License
MIT — see LICENSE.
Metadata
Release files for reactifact 0.24.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| reactifact-0.24.0.tar.gz | 815.5 kB | Without provenance | Details for reactifact-0.24.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| reactifact-0.24.0-py3-none-any.whl | Python 3 | none | any | Details for reactifact-0.24.0-py3-none-any.whl |
Total release size: 1.5 MB
Release files / reactifact-0.24.0.tar.gz
| Download URL | reactifact-0.24.0.tar.gz |
|---|---|
| Size | 815.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a36c261c21d71584be1c3949cb8be327d99d3de15eb3aa1ecdd4042b713be51f
|
|
BLAKE2b-256 checksum How to use checksums |
ff32e3bfa5d36492426d01cc17a3b877131eac3ea0f9e19a18d0c64523f5c578
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / reactifact-0.24.0-py3-none-any.whl
| Download URL | reactifact-0.24.0-py3-none-any.whl |
|---|---|
| Size | 726.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f56b4c8823956cf63d23ba446eec71f0c9e3c7eb162b753f9641f3c5856ef4b
|
|
BLAKE2b-256 checksum How to use checksums |
95c52915052a8a8b72398350108a73985e9c4f5d0d512dbcefc682ec627fa667
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for reactifact 0.24.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.