Skip to main content

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 tool
  • custom_prompt.py — extend or replace the system prompt
  • custom_llm.py — plug in your company's internal LLM via the BaseLLM protocol
  • custom_frontend.py — drive the agent from Jupyter / Slack / web
  • movielens_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 RecommenderConfig shape, poor metric choice). The scikit-rec factory catches bad configs at train_model; the rest is on the user.
  • Invented keyword arguments for external libraries. We flag pandas as unverified, not the specific make_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scikit_rec_agent-0.1.0.tar.gz (78.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scikit_rec_agent-0.1.0-py3-none-any.whl (51.8 kB view details)

Uploaded Python 3

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

Hashes for scikit_rec_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 98a41f249c72a50f6873c73f747aa5d9e3eb12776579e5193a67ca728a2069f9
MD5 beba55532d1bedc7c15fe16733330f22
BLAKE2b-256 7339ebe608ff13d98bf33e66c7bbdd2ce4caca122873e57c75101d2a848c9808

See more details on using hashes here.

Provenance

The following attestation bundles were made for scikit_rec_agent-0.1.0.tar.gz:

Publisher: publish.yml on intuit/scikit-rec-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scikit_rec_agent-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for scikit_rec_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5622ef21c952b5fb23ebdde607c2897211a93cb241211d6fad1893ac5a37fdb9
MD5 1b91e93d0a030c4f1cef2a6422f0d61c
BLAKE2b-256 2ebc5c2f2cbda03eb63aa9733cd5dc0cba2f0fd60d43fea8856eb822bf3448b1

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page