feat(agent-obs): add Topic Discovery (Patterns) commands - #683
Merged
platinummonkey merged 1 commit intoJul 27, 2026
Merged
Conversation
Closes the last fully-missing LLM Observability MCP domain in pup: all 7 Topics Discovery tools now have a CLI equivalent under `pup llm-obs patterns`. Topic Discovery clusters LLM Obs spans into a topic hierarchy — a config defines what to cluster, a run is one clustering, and a completed run yields topics backed by clustering points. New commands, one per MCP tool (all read-only): - patterns configs list -> list_llmobs_pattern_configs - patterns configs get -> get_llmobs_pattern_config - patterns runs list -> list_llmobs_pattern_runs - patterns runs status -> get_llmobs_pattern_run_status - patterns topics -> get_llmobs_patterns - patterns topics-with-points -> get_llmobs_patterns_with_points - patterns points -> get_llmobs_pattern_points Optional args are omitted from the request body rather than sent as defaults, so the server's own defaults apply — matching MCP behavior for run_id (latest run), include_metrics, and the points page_size/page_token cursor. Shared patterns_post helper keeps the seven thin wrappers to one line of transport each (src/commands/llm_obs.rs:974). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
platinummonkey
approved these changes
Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
pup llm-obs patterns, closing the last fully-missing LLM Observability MCP domain in pup. All 7 Topics Discovery tools now have a CLI equivalent.Topic Discovery clusters LLM Obs spans into a topic hierarchy: a config defines what to cluster (via
evp_query), a run is one clustering of those spans at a point in time, and a completed run yields topics, each backed by clustering points (spans).Follow-up to #681, which closed the project/dataset/span-search gaps.
Changes
Seven new commands, one per MCP tool — all read-only (
src/commands/llm_obs.rs:974):patterns configs listlist_llmobs_pattern_configstopic-discovery/configs/listpatterns configs getget_llmobs_pattern_configtopic-discovery/config/getpatterns runs list --config-idlist_llmobs_pattern_runstopic-discovery/runs/listpatterns runs status --config-idget_llmobs_pattern_run_statustopic-discovery/run-statuspatterns topics --config-id [--run-id]get_llmobs_patternstopic-discovery/topicspatterns topics-with-points --config-id [--run-id] [--include-metrics]get_llmobs_patterns_with_pointstopic-discovery/topics-with-pointspatterns points --topic-id [--page-size] [--page-token]get_llmobs_pattern_pointstopic-discovery/clustered-pointsThe subcommand layout follows the natural read flow:
configs list→runs status→topics→points.Two design notes:
run_id(latest completed run),include_metrics, and thepage_size/page_tokencursor. Two tests pin this by asserting the key is absent rather thanfalse/null.patterns_posthelper keeps the seven wrappers to one line of transport each, rather than repeating the path-build/POST/map_err/output chain seven times.Arg schemas were taken from the live MCP server, not the dd-source checkout, which was several days stale. They matched, including the non-obvious detail that
configs gettakes no arguments — it returns the most-recently-modified config for the org, soconfigs listis how you resolve a specificconfig_id.Testing
14 new tests:
Matcher::Jsonbody assertions per endpoint, verifyingconfig_id/run_id/topic_idand the paging args reach the server exactly as expectedconfigs get(an org with no config yet), 404 on unknown topic, 500 on run-status, and a no-auth casecargo fmt --check,cargo clippy --all-targets -- -D warnings, andcargo test llm_obs(116 passing) are clean.I also verified all 7 leaves classify as
read_only: truein the agent schema. Worth checking becausepatterns runs statusyields the leaf namestatus, which sits close to the write-verb list inis_write_command_name.Smoke-tested end to end against the live API on a real config (
Eval: product-analytics-vs-rum-tool-selection): listed configs, resolved the latest run ascompleted, read the topic hierarchy (Incorrect Datadog tool or action choice, 3 points), pulled a page of 2 points, then followed the returnednext_page_tokento page 2 and got a different set of spans — confirming the cursor actually advances.Still open
From the same audit, for follow-up: Agent Insights (4 tools, gated behind the
llm-obs-insightsfeature flag),get_llmobs_model_pricingandget_llmobs_bits_session(both org-2 allowlisted in the MCP), and the 9 LLM-Obs workflow skills thatpup skillscan't reach (it targets/api/v2/onboarding/skills, a different backend).🤖 Generated with Claude Code