Concepts
Features, runs and customers
Labels turn "we spent $4,000" into "the report builder spent $1,900, and $600 of it was loops".
Feature
Which part of your product made the call.
import zexl
with zexl.feature("support-reply"):
reply = client.chat.completions.create(...)Without a label, Zexl uses the HTTP route of the current request when there is one, else the module.function that made the call. If your function names are sensitive, set the feature yourself.
Run
One unit of agent work: all the calls an agent made to finish one task. Waste patterns like loops are found within a run, and Run detail shows a run step by step.
Zexl groups runs automatically when each request continues the previous answer (the usual agent loop), or when you use the OpenAI Responses API's previous_response_id. If your app already has an OpenTelemetry trace, the trace is the run.
Group a run yourself when the agent trims or summarises its history, or uses sub-agents:
with zexl.run("research", feature="report-builder"):
agent.solve(task)
@zexl.run() # or as a decorator
def summarise(doc): ...Customer
Which of your customers the spend was for.
zexl.set_customer(account.id) # an id, never an email or a name