Vai al contenuto principale
Beta non calibrata
StrikeStrike

Tracing

Call-graph spans, export to POST /v1/traces, and annotating branches.

strikeflow records each agent run as a tree of spans and exports gzip JSON batches to Strike (run, step, and decision span types).

Enable export

Tracing exports when all of the following hold:

  1. STRIKEFLOW_TRACING is not 0
  2. STRIKE_API_KEY is set
  3. STRIKE_PROJECT is set (or you pass project= to strike.trace)
Python
import os
import strikeflow as strike

os.environ["STRIKE_PROJECT"] = "support-bot"
strike.configure(api_key=os.environ["STRIKE_API_KEY"])

Open a run

Python
import strikeflow as strike

with strike.trace("support-agent", run_id="ticket-4411") as run:
    with run.step("triage"):
        result = strike.decide("Refund?", "yes_no", context="Duplicate charge reported.")
    print(result.trace_id)
strike.flush()  # wait for background export (also runs at process exit)

Child spans:

  • run.llm(provider, model) for LLM calls you record manually
  • run.tool(name, host=...) for tool calls
  • run.step(name) for generic steps

Decisions made inside an open run become type: "decision" spans with probabilities and metadata.

Standalone decisions

If you call decide without strike.trace, the tracer still emits a minimal run when STRIKE_PROJECT is set. Pass run_id= to align with your host framework id (LangGraph thread id, OpenAI response id, etc.).

Annotate routing

After you choose a branch in application code, upsert path_taken and optional fallback metadata:

Python
import strikeflow as strike

result = strike.decide("Which team?", ["billing", "tech"], context="unclear message")
if result.confidence < 0.7:
    strike.get_tracer().annotate(
        result.trace_id,
        path_taken="llm",
        fallback={"used": True, "reason": "low_confidence", "to": "llm", "threshold": 0.7},
    )

Ingest upserts by span_id, so annotations can arrive in a later batch.

Transport

ItemValue
URLPOST {STRIKE_API_URL}/v1/traces
AuthAuthorization: Bearer <STRIKE_API_KEY>
Bodygzip JSON: {"sdk":"strikeflow-py/<version>","project":"...","spans":[...]}
Size limit1 MB per batch (larger batches are dropped)

Export runs on a background thread and never raises into your agent.

LangChain / LangGraph

Install strikeflow[langchain] and attach strikeflow.integrations.langchain.callback_handler() to record LLM and tool spans. LangGraph strike_router writes path_taken and metadata.fallback automatically.

Console graph view

Spans exported with your project name can appear in the Strike console graph view when trace storage is available. See Graph view.

Tracing: Strike docs