Coming from MLflow¶
The tracking API follows MLflow's, so most names carry over.
| MLflow | LaneTrace |
|---|---|
mlflow.set_tracking_uri() / MLFLOW_TRACKING_URI |
lanetrace.set_tracking_uri() / LANETRACE_TRACKING_URI |
mlflow.get_tracking_uri() |
lanetrace.get_tracking_uri() |
mlflow.set_experiment() / MLFLOW_EXPERIMENT_NAME |
lanetrace.set_project() / LANETRACE_PROJECT |
mlflow.start_run() / active_run() / end_run() |
the same names |
@mlflow.trace |
@lanetrace.trace |
mlflow.langchain.autolog() |
lanetrace.langchain.autolog() |
MlflowClient |
lanetrace.LaneTraceClient |
mlflow ui |
lanetrace ui |
What differs¶
- A run is an ordered list of events, not params and metrics. Each event
is one arrow of the diagram: a
source, atarget, atype(llm_call,tool_call,tool_result,handoff,errororfinal_answer), and optionally alabel, a JSONpayload, a duration and a status. See the event contract. - A project plays the experiment's part. Projects are created on first use,
by name; without
set_project()orLANETRACE_PROJECT, runs go toDefault. start_run()returns the run, which is a context manager: leaving the block ends itcompleted, orfailedif an exception escaped.end_run(status)ends the current run.log_event()and@lanetrace.tracedon't block and don't raise (except aValueErrorfor an unknown event type): each run writes from its own background thread, and a storage error turns tracing off for that run. Ending a run, withend_run()or by leaving thestart_run()block, waits for its writes, at most 10 seconds. An exit hook ends and flushes the runs still open, so short scripts don't lose their last events.
Tracking URIs¶
The tracking URI is the first of:
lanetrace.set_tracking_uri(uri);LANETRACE_TRACKING_URI;LANETRACE_URL, the pre-0.2 variable: a full.../api/eventsURL, of which the server part is used;http://localhost:3000, when onlyLANETRACE_KEYis set (the pre-0.2 default server; a warning says so once);sqlite:///./lanetrace.db.
| Tracking URI | Runs go to |
|---|---|
sqlite:///./lanetrace.db (the default) or another SQLite file |
that file, written directly; lanetrace ui reads it (--database-url for another file) |
another SQLAlchemy URL, such as postgresql+psycopg://... |
that database, written directly; the tables are created on the first write |
http://host:port or https://... |
a running lanetrace ui, through POST /api/events |
Over HTTP, LANETRACE_KEY is sent when it is set: the run then goes to that
key's project, and set_project() is ignored. Without a key, each run names its
project, which only a server running with --auth none accepts.
The explicit client¶
Like MlflowClient, LaneTraceClient is synchronous and raises on any error: