tdfs4ds.agentops.smoke¶
tdfs4ds.agentops.smoke
¶
Post-deployment smoke test against a live agent URL.
Closes the arc: preflight -> generate -> write -> deploy -> smoke test. Runs from the notebook, which holds the JWT and can reach the APISIX gateway; it does not run inside the pod.
Two of its six checks are the reason this is worth writing rather than curling the endpoint once:
grounded
A generic smoke test cannot distinguish "the LLM replied" from "the agent
replied from the feature store". A pod whose Teradata connection failed
still answers — fluently, and about nothing. This check asserts a real
catalog name appears in the response, reusing
:func:~tdfs4ds.agent.consumer_agent._known_catalog_names, which only
tdfs4ds is in a position to know.
session_isolation
If the thread id ever degrades to a constant, every caller lands in one
shared conversation and answers leak between users. That reads as a working
memory feature from the outside, and a "does it respond?" test passes it
happily. Here a fresh session must show no trace of the previous one.
The pair also localises a fault: session_memory failing while
session_isolation passes means session_id never reached the graph; both
failing means the thread id is constant.
Contracts, matching the other two reports and tested: never raises, never prints a secret (the token is used, never echoed), and each check is wrapped so one failure neither aborts the run nor hides what follows.
_SMOKE_CHECKS
module-attribute
¶
_SMOKE_CHECKS = (_check_reachable, _check_answers, _check_grounded, _check_session_memory, _check_session_isolation, _check_latency)
_short
¶
First line of text, truncated — errors are often multi-page.
Exceptions are flattened first, so a task-group wrapper never hides the
cause from the caller or from :func:_match_hint.
run_checks
¶
Run checks and assemble the report.
Parameters¶
checks : sequence of callable
Each takes (live, context) and returns a :func:_result dict.
context : dict, optional
Passed to every check — the shared state a report needs (an agent URL,
a token, an accumulating latency record).
Returns¶
dict
{"ok", "version", "live", "checks"}. ok is True when nothing
failed; a skipped check does not fail the run.
_invoke
¶
POST one turn. Returns (status_code, output_text, elapsed_ms).
_check_answers
¶
The entrypoint ran end to end and produced something.
_check_grounded
¶
The answer came from the feature store, not just the model.
_check_session_memory
¶
A second turn on the same session resolves a back-reference.
_check_session_isolation
¶
A different session does NOT inherit the first conversation.
check_deployed_agent
¶
Exercise a deployed AgentOps agent and report what works.
Sends three turns: an opening question, a follow-up on the same
session_id, and the same follow-up on a fresh one. Between them they
establish that the pod is reachable, answers, answers from the feature
store, remembers within a session and does not leak across sessions.
Parameters¶
agent_url : str
The agent_url from GET /agents/{agent_id}. A trailing
/invoke is added when absent.
token : str, optional
JWT bearer token. Defaults to TDFS4DS_TD_PASSWORD-independent
environment lookup of TDFS4DS_AGENTOPS_TOKEN; in AI Studio pass the
notebook's user_token.
live : bool, default True
`False makes no HTTP call — every check reports as skipped. For
wiring tests.
display : bool, default True
Print the aligned summary.
Returns¶
dict
{"ok", "version", "live", "checks": [...]}, the same shape as
:func:tdfs4ds.check_configuration.
Notes¶
Never raises, and never prints the token.
Examples¶
tdfs4ds.check_deployed_agent(agent_url, token=user_token) # doctest: +SKIP