Reusable analysis-recipe framework with sensory recipes#434
Merged
Conversation
A package-wide recipe framework (process_improve/recipes.py): frozen RecipeStep / AnalysisRecipe dataclasses, a register_recipe registry with lazy discover_recipes (mirroring discover_tools), a substring cue matcher select_recipe, and a general select_analysis_recipe agent tool that matches across every registered recipe and always returns the full catalogue. The sensory subpackage is the first consumer (sensory/recipes.py): guided workflows for data intake, panel consistency / scale-use correction, and relating attributes to covariates with the genuine/proxy/coincidence separation, plus a parked placeholder for a future visualisation workflow. Each step references the real sensory tools by name.
| return | ||
| for module in _RECIPE_MODULES: | ||
| _import_recipe_module(module) | ||
| _recipes_discovered = True |
tests/test_recipes.py covers the payload serialisation, the registry (duplicate-key rejection), recipe matching, catalog integrity (every tool a recipe step names is a registered tool), and the select_analysis_recipe tool path. MINOR version bump for the new feature, with CITATION and CHANGELOG in sync.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
What and why
Agents have many tools but no guidance layer: faced with an open-ended request
("I have a panel file, what do I do?", "are my panelists consistent?", "what
drives sweetness?") they have to improvise the order of tool calls. This adds a
small, reusable framework for predefined, step-by-step analysis recipes that an
agent matches to a request and follows deterministically, chaining existing tools
by name.
The framework is package-wide and domain-agnostic so any subpackage can register
its own recipes later; the sensory subpackage is the first consumer.
What changed
process_improve/recipes.py(new, general): frozenRecipeStep/AnalysisRecipedataclasses with a JSONto_payload, aregister_reciperegistry plus a lazy
discover_recipes()(mirrorsdiscover_tools), a simplesubstring cue matcher
select_recipe, andlist_recipes/get_recipe. Asingle general agent tool
select_analysis_recipematches across everyregistered recipe and always returns the full catalogue so the agent can offer
a choice even on no match.
process_improve/sensory/recipes.py(new): four guided workflowsregistered into the catalog: data intake (organise + check), panel consistency
/ scale-use correction (with plain-language interpretation of the MAM beta),
relating attributes to covariates (marginal associations plus the
cross-validated discriminator, with the genuine / proxy / coincidence verdict
and the collinearity caveat), and a parked placeholder for a future
visualisation workflow. Steps reference only the real sensory tools.
tool_spec.discover_tools()now importsprocess_improve.recipesso therecipe-selection tool registers alongside the others.
Tests / verification
New
tests/test_recipes.pycovers the dataclass payload, the registry(duplicate-key rejection), matching, catalog integrity (every tool named by a
recipe step is a registered tool), and the agent-tool path.
ruffandmypyclean. Version bumped with the change.
Generated by Claude Code