Conversational AI agent that drives scikit-rec via tool use
Project description
scikit-rec-agent
Conversational AI agent that uses scikit-rec as its tool belt. The agent reasons about the user's data and goals, then calls scikit-rec APIs via structured tool use to build, evaluate, and compare recommendation systems.
Install
pip install scikit-rec-agent[anthropic] # with Claude
pip install scikit-rec-agent[openai] # with GPT-4
pip install scikit-rec-agent # bring your own LLM
pip install scikit-rec-agent[anthropic,torch] # + deep-learning models
CLI
export ANTHROPIC_API_KEY=...
scikit-rec-agent chat
Auto-detects the provider from env vars. Pass --provider {anthropic,openai} if both are set.
Library
import anthropic
from scikit_rec_agent import Agent
from scikit_rec_agent.llm.anthropic import AnthropicAdapter
agent = Agent(llm=AnthropicAdapter(anthropic.Anthropic()))
for event in agent.chat_turn("I have click data at /data/interactions.csv — help me build a ranker"):
...
See examples/ for:
custom_tool.py— register a user-defined toolcustom_prompt.py— extend or replace the system promptcustom_llm.py— plug in your company's internal LLM via theBaseLLMprotocolcustom_frontend.py— drive the agent from Jupyter / Slack / webmovielens_session.md— annotated end-to-end transcript
What it does
Eleven tools cover the full scikit-rec workflow: profile data, validate schemas, build datasets, split (temporal / per-user / cold-start), train (6 recommender types × 6 scorers × 3 estimator planes), evaluate (7 evaluator types × 9 metrics), compare, run HPO (Optuna), and persist to a local model registry.
The system prompt is built at import time from scikit-rec's live enum maps, so new recommender/scorer/estimator types get picked up automatically.
Hallucination safeguards
The agent runs two deterministic detectors on every turn's output:
- URL echo check — flags
https://...links the model introduces that the user did not supply this session. Shipped adapters have no web retrieval, so model-introduced URLs are common fabrications. - Foreign-reference check — scans fenced Python blocks for imports and bare-alias usage outside
{skrec, scikit_rec, scikit_rec_agent, stdlib}. Library APIs we own have a runtime backstop via the scikit-rec factory; external libraries don't.
Warnings are emitted as AgentEvent(type="warning") and never enter conversation history. Opt out with Agent(..., enable_safeguards=False).
Scope and limitations
The detectors are deliberately narrow. They catch the common confident-plausible-looking fabrication case with near-zero false positives, not every possible hallucination. What they do not catch:
- Semantic errors inside trusted APIs (wrong
RecommenderConfigshape, poor metric choice). The scikit-rec factory catches bad configs attrain_model; the rest is on the user. - Invented keyword arguments for external libraries. We flag
pandasas unverified, not the specificmake_up_kwarg=True. - Fabricated dataset names, paper citations, or prose claims. We only inspect URLs and Python code blocks.
- Adversarial evasion (aliased
importlib, f-string import args, triple-backticks inside docstrings,ast.parse-rejecting blocks).
See scikit_rec_agent/safeguards.py for the full contract.
Architecture
See agentic_design.md for the authoritative spec.
Contributing
Contributions welcome — see CONTRIBUTING.md for dev setup, test commands, and where new work fits best.
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scikit_rec_agent-0.1.0.tar.gz.
File metadata
- Download URL: scikit_rec_agent-0.1.0.tar.gz
- Upload date:
- Size: 78.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98a41f249c72a50f6873c73f747aa5d9e3eb12776579e5193a67ca728a2069f9
|
|
| MD5 |
beba55532d1bedc7c15fe16733330f22
|
|
| BLAKE2b-256 |
7339ebe608ff13d98bf33e66c7bbdd2ce4caca122873e57c75101d2a848c9808
|
Provenance
The following attestation bundles were made for scikit_rec_agent-0.1.0.tar.gz:
Publisher:
publish.yml on intuit/scikit-rec-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scikit_rec_agent-0.1.0.tar.gz -
Subject digest:
98a41f249c72a50f6873c73f747aa5d9e3eb12776579e5193a67ca728a2069f9 - Sigstore transparency entry: 1343145110
- Sigstore integration time:
-
Permalink:
intuit/scikit-rec-agent@aed885280b07ebce2c563938133af6800e631762 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/intuit
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aed885280b07ebce2c563938133af6800e631762 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file scikit_rec_agent-0.1.0-py3-none-any.whl.
File metadata
- Download URL: scikit_rec_agent-0.1.0-py3-none-any.whl
- Upload date:
- Size: 51.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5622ef21c952b5fb23ebdde607c2897211a93cb241211d6fad1893ac5a37fdb9
|
|
| MD5 |
1b91e93d0a030c4f1cef2a6422f0d61c
|
|
| BLAKE2b-256 |
2ebc5c2f2cbda03eb63aa9733cd5dc0cba2f0fd60d43fea8856eb822bf3448b1
|
Provenance
The following attestation bundles were made for scikit_rec_agent-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on intuit/scikit-rec-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scikit_rec_agent-0.1.0-py3-none-any.whl -
Subject digest:
5622ef21c952b5fb23ebdde607c2897211a93cb241211d6fad1893ac5a37fdb9 - Sigstore transparency entry: 1343145179
- Sigstore integration time:
-
Permalink:
intuit/scikit-rec-agent@aed885280b07ebce2c563938133af6800e631762 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/intuit
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aed885280b07ebce2c563938133af6800e631762 -
Trigger Event:
workflow_dispatch
-
Statement type: