This is the easiest end-to-end guide for workflow developers.
- Docs site: https://flowcept.readthedocs.io/
- Swagger (when webservice is running):
http://127.0.0.1:8008/docs - OpenAPI (ReadTheDocs):
If you only want to see Flowcept working in 2 minutes:
pip install flowcept
flowcept --init-settings
python examples/start_here.pyThen inspect flowcept_buffer.jsonl.
- I want local/offline only (no services): go to Offline path
- I want DB/API querying: go to Online DB path
- I want natural-language querying with an agent: go to Agentic path
- I want polished reports: go to Provenance reports
- 1) Install and setup
- 2) Capture provenance
- 3) Access captured provenance
- 4) Provenance reports
- 5) Architecture
Install base package:
pip install flowceptGenerate settings:
flowcept --init-settingsFull file vs runtime mode:
flowcept --init-settings --full -y
flowcept --config-profile full-online -yImportant: settings.yaml is the single source of truth for Flowcept runtime behavior.
- default path:
~/.flowcept/settings.yaml - override path env var:
FLOWCEPT_SETTINGS_PATH
Settings reference:
- https://flowcept.readthedocs.io/en/latest/setup.html
- https://github.com/ORNL/flowcept/blob/main/resources/sample_settings.yaml
Quick config profiles (recommended):
flowcept --config-profile full-online
flowcept --config-profile full-telemetry
flowcept --config-profile mq-only
flowcept --config-profile full-offline
flowcept --config-profile mq-only-no-flushWhat this does:
- Shows exactly which
settings.yamlkeys will be changed and the new values. - Asks for confirmation before writing.
- Writes to
FLOWCEPT_SETTINGS_PATHwhen set, otherwise~/.flowcept/settings.yaml.
Skip confirmation:
flowcept --config-profile full-online -yCurrent profile behavior:
full-online:project.db_flush_mode: onlinemq.enabled: truekv_db.enabled: truedatabases.mongodb.enabled: truedatabases.lmdb.enabled: false
mq-only:project.db_flush_mode: onlinemq.enabled: truekv_db.enabled: falsedatabases.mongodb.enabled: falsedatabases.lmdb.enabled: false- Use
Flowcept(check_safe_stops=False)with this profile.
full-offline:project.db_flush_mode: offlineproject.dump_buffer.enabled: truemq.enabled: falsekv_db.enabled: falsedatabases.mongodb.enabled: falsedatabases.lmdb.enabled: false
mq-only-no-flush:project.db_flush_mode: offlineproject.dump_buffer.enabled: truemq.enabled: truekv_db.enabled: falsedatabases.mongodb.enabled: falsedatabases.lmdb.enabled: false- Tasks accumulate locally and are bulk-published to MQ in a single end-of-run flush. Also dumps to local JSONL. Use
Flowcept(check_safe_stops=False).
full-telemetry:- enables CPU, per-CPU, process, memory, disk, network, machine telemetry
- keeps
telemetry_capture.gpu: null
Adapter setup is additive:
flowcept --init-settings --dask -y
flowcept --init-settings --mlflow -y
flowcept --init-settings --tensorboard -yThese commands add adapters.<name> to the current settings file.
Use:
examples/start_here.py
Run:
python examples/start_here.pySample code (decorator-based, simplest path):
import json
from flowcept import Flowcept, flowcept_task
from flowcept.instrumentation.flowcept_decorator import flowcept
@flowcept_task(output_names="o1")
def sum_one(i1):
return i1 + 1
@flowcept_task(output_names="o2")
def mult_two(o1):
return o1 * 2
@flowcept
def main():
n = 3
o1 = sum_one(n)
o2 = mult_two(o1)
print("Final output", o2)
if __name__ == "__main__":
main()
prov_buffer = Flowcept.read_buffer_file()
print(json.dumps(prov_buffer, indent=2))Use:
examples/unmanaged/simple_task2.pyexamples/unmanaged/simple_task.pyexamples/unmanaged/main.py
These show explicit FlowceptTask, .send(), context manager, tags, and metadata.
Sample code (explicit task objects, no decorators):
import uuid
from time import sleep
from flowcept import Flowcept, FlowceptTask
if __name__ == "__main__":
agent1 = str(uuid.uuid4())
flowcept = Flowcept(
start_persistence=False,
save_workflow=True,
workflow_name="My First Workflow",
campaign_id="my_super_campaign",
).start()
# 1) direct event emission
FlowceptTask(activity_id="super_func1", used={"x": 1}, agent_id=agent1, tags=["tag1"]).send()
# 2) context-managed start/end
with FlowceptTask(activity_id="super_func2", used={"y": 1}, agent_id=agent1, tags=["tag2"]) as t2:
sleep(0.5)
t2.end(generated={"o": 3})
# 3) explicit start + explicit end
t3 = FlowceptTask(activity_id="super_func3", used={"z": 1}, agent_id=agent1, tags=["tag3"])
sleep(0.1)
t3.end(generated={"w": 1})
flowcept.stop()PyTorch + loops:
- docs: https://flowcept.readthedocs.io/en/latest/prov_capture.html
- example:
examples/single_layer_perceptron_example.py - loop example:
examples/instrumented_loop_example.py - tests:
tests/instrumentation_tests/ml_tests/single_layer_perceptron_test.pytests/instrumentation_tests/flowcept_loop_test.py
Adapters:
- MLflow:
examples/mlflow_example.pynotebooks/mlflow.ipynbtests/adapters/test_mlflow.py
- Dask:
examples/dask_example.pynotebooks/dask.ipynbtests/adapters/test_dask.py
- TensorBoard:
examples/tensorboard_example.pynotebooks/tensorboard.ipynbtests/adapters/test_tensorboard.py
Agentic provenance / MCP:
- docs: https://flowcept.readthedocs.io/en/latest/agent.html
- agent readme:
src/flowcept/agents/README.md - code-assistant routing:
AGENTS.md - agent tests:
tests/agent/agent_tests.py - PROV-AGENT paper: https://arxiv.org/abs/2508.02866
Best for simple local runs and CI-lite usage.
Install:
pip install flowceptUse this config:
project:
db_flush_mode: offline
dump_buffer:
enabled: true
path: flowcept_buffer.jsonl
mq:
enabled: false
kv_db:
enabled: false
databases:
mongodb:
enabled: false
lmdb:
enabled: falseRead file via Flowcept:
from flowcept import Flowcept
docs = Flowcept.read_buffer_file("flowcept_buffer.jsonl")
df = Flowcept.read_buffer_file("flowcept_buffer.jsonl", return_df=True, normalize_df=True)Read file via pandas:
import pandas as pd
df = pd.read_json("flowcept_buffer.jsonl", lines=True)Use this when you need workflow/task/object queries after execution.
Typical config requirements:
project.db_flush_mode: onlinemq.enabled: truekv_db.enabled: truedatabases.mongodb.enabled: true(or LMDB mode)
Install:
pip install flowcept[mongo]Examples:
from flowcept import Flowcept
tasks = Flowcept.db.get_tasks_from_current_workflow()
failed = Flowcept.db.query(
collection="tasks",
filter={"status": "ERROR"},
projection={"_id": 0, "task_id": 1, "activity_id": 1, "stderr": 1},
limit=20,
)
wfs = Flowcept.db.workflow_query(filter={"name": "Perceptron GridSearch"})
objs = Flowcept.db.query(collection="objects", filter={"workflow_id": Flowcept.current_workflow_id})More docs:
- https://flowcept.readthedocs.io/en/latest/prov_query.html
- https://flowcept.readthedocs.io/en/latest/api-reference.html
Install:
pip install flowcept[webservice,mongo]Start webservice:
flowcept --start --webservice --webservice-host=127.0.0.1 --webservice-port=8008Quick curl examples:
curl -s http://127.0.0.1:8008/api/v1/health/live
curl -s 'http://127.0.0.1:8008/api/v1/tasks?limit=5'
curl -s -X POST http://127.0.0.1:8008/api/v1/tasks/query \
-H 'Content-Type: application/json' \
-d '{"filter":{"status":"FINISHED"},"limit":5}'Docs endpoints:
- Swagger: http://127.0.0.1:8008/docs
- ReDoc: http://127.0.0.1:8008/redoc
- OpenAPI JSON: http://127.0.0.1:8008/openapi.json
- ReadTheDocs REST docs: https://flowcept.readthedocs.io/en/latest/rest_api.html
Install:
pip install flowcept[redis]CLI stream helper:
flowcept --stream-messages
flowcept --stream-messages --keys-to-show activity_id,workflow_id,statusExamples:
examples/consumers/simple_consumer.pyexamples/consumers/simple_publisher.pyexamples/consumers/ping_pong_example.py
Paper: https://arxiv.org/abs/2509.13978
Install:
pip install flowcept[llm_agent]Recommended for Codex/Claude/Gemini users.
- Start MCP server in a separate terminal:
flowcept --start --agent- Configure external-LLM mode:
agent:
external_llm: true
mcp_host: 127.0.0.1
mcp_port: 8000- In your assistant session, read
AGENTS.md, then followdocs/agent.rstandsrc/flowcept/agents/README.md.
Flowcept builds the model using build_llm_model() (src/flowcept/agents/llm/builders.py).
Providers in code:
openaiazuregooglesambanova
Common settings under agent:
service_providermodelmodel_kwargsapi_keyllm_server_urlmcp_host,mcp_port
Start agent UI:
flowcept --start --agent-guiDeployment file:
deployment/compose-grafana.yml
Use this for online telemetry dashboards and KPI correlations (for example loss vs CPU/GPU behavior).
Telemetry docs:
Default report mode:
report_type="workflow_card"format="markdown"
The rendered workflow card follows the upstream Workflow Card template: https://github.com/data-cards/workflow-provenance-card.
Python API:
from flowcept import Flowcept
Flowcept.generate_report(
report_type="workflow_card",
format="markdown",
workflow_id="<workflow_id>",
output_path="WORKFLOW_CARD.md",
)REST download:
curl -s -X POST \
http://127.0.0.1:8008/api/v1/workflows/<workflow_id>/reports/workflow-card/downloadDocs:
Install:
pip install flowcept[report_pdf]Generate:
from flowcept import Flowcept
Flowcept.generate_report(
report_type="provenance_report",
format="pdf",
workflow_id="<workflow_id>",
output_path="PROVENANCE_REPORT.pdf",
)PDF report supports ML-specialized KPI plotting when signals are available.
One-line architecture:
- capture (instrumentation/adapters) -> MQ -> DB/file -> query via Python/REST/agent -> report.
Read more:
- https://flowcept.readthedocs.io/en/latest/architecture.html
- https://flowcept.readthedocs.io/en/latest/prov_capture.html
- https://flowcept.readthedocs.io/en/latest/prov_storage.html
- https://flowcept.readthedocs.io/en/latest/prov_query.html
- https://flowcept.readthedocs.io/en/latest/agent.html
- Symptom:
flowcept: command not found- Fix: activate your Python env first, then reinstall:
pip install flowcept
- Fix: activate your Python env first, then reinstall:
- Symptom: no
flowcept_buffer.jsonlafter running offline example- Fix: ensure
project.db_flush_mode: offlineandproject.dump_buffer.enabled: truein settings
- Fix: ensure
- Symptom:
ValueErroraboutdb_flush_modevs MQ/DB settings- Fix: keep config consistent:
- Offline mode (no MQ/KV/DBs):
flowcept --config-profile full-offline -y - Offline mode with end-of-run MQ flush:
flowcept --config-profile mq-only-no-flush -y - Online mode:
flowcept --config-profile full-online -yorflowcept --config-profile mq-only -y
- Offline mode (no MQ/KV/DBs):
- Fix: keep config consistent:
- Symptom:
ValueErroraboutcheck_safe_stops=Truerequiring KV while MQ is enabled- Fix: either use
flowcept --config-profile full-online -y, or usemq-only/mq-only-no-flushand instantiateFlowcept(check_safe_stops=False)
- Fix: either use
- Symptom: REST API import/start failures (
fastapi/uvicornmissing)- Fix:
pip install flowcept[webservice,mongo]
- Fix:
- Symptom:
Flowcept.dbqueries fail due to missing Mongo deps- Fix:
pip install flowcept[mongo]
- Fix:
- Symptom: agent won’t respond / cannot connect
- Fix:
- start server:
flowcept --start --agent - confirm
agent.mcp_host/agent.mcp_portin settings - in external assistant mode, follow
AGENTS.mdanddocs/agent.rst
- start server:
- Fix:
- Symptom: PDF report generation fails
- Fix: install report deps:
pip install flowcept[report_pdf]
- Fix: install report deps:
# Install
pip install flowcept
pip install flowcept[mongo]
pip install flowcept[webservice,mongo]
pip install flowcept[llm_agent]
pip install flowcept[report_pdf]
# Init settings
flowcept --init-settings
flowcept --config-profile full-online
flowcept --config-profile mq-only
flowcept --config-profile full-offline
flowcept --show-settings
# Start services
flowcept --start --webservice --webservice-host=127.0.0.1 --webservice-port=8008
flowcept --start --agent
flowcept --start --agent-gui
# Stream MQ messages
flowcept --stream-messages
flowcept --stream-messages --keys-to-show activity_id,workflow_id,status
# Run simple example
python examples/start_here.py# Python quick calls
from flowcept import Flowcept
# Read offline buffer
docs = Flowcept.read_buffer_file("flowcept_buffer.jsonl")
df = Flowcept.read_buffer_file("flowcept_buffer.jsonl", return_df=True, normalize_df=True)
# Generate markdown workflow card
Flowcept.generate_report(
report_type="workflow_card",
format="markdown",
workflow_id="<workflow_id>",
output_path="WORKFLOW_CARD.md",
)
# Generate PDF provenance report
Flowcept.generate_report(
report_type="provenance_report",
format="pdf",
workflow_id="<workflow_id>",
output_path="PROVENANCE_REPORT.pdf",
)