py-spy for LLM reasoning.
One decorator on your agent function. Per-step cognometric readout — drift, confabulation, refusal, sycophancy, phase transition, low trust, incoherence — localized to the step that produced them. langsmith tells you the trace broke. styxx.profile tells you why.
One decorator. Any LLM-using function works inside.
import styxx
from styxx import OpenAI # raw openai, langchain, crewai, autogen — all work
@styxx.profile
def my_agent(task):
client = OpenAI()
r = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": task}],
logprobs=True, top_logprobs=5,
)
return r.choices[0].message.content
result, profile = my_agent("summarize this report")
for step in profile.steps:
print(step.cognometric_fingerprint)
# {sycophancy: 0.04, drift: 0.18, hallucination: 0.02, ...}
Per-step localization. Every fault, attached to its origin.
Goal drift across turns
The agent moved away from its anchor. Localized to the turn where divergence began.
Confabulation
Fluent claim with no grounding signal. Per-token attribution of which claim broke.
Refusal
The model declined. Did it decline because it should — or because it confused capability with policy?
Sycophancy
Yielding without evidence. K=1 superlative-density signature, attached to the step.
Phase transition
The model crossed a discrete state boundary mid-trace. Refusal → answer, retrieval → reasoning, etc.
Low trust
Cognometric reward score per response. Drop-in for cogn-RLHF training reflection.
One line. Cognitive vitals on every agent.
pip install -U styxx — then add @styxx.profile above any function. Works with raw openai, langchain, crewai, autogen, custom code.