Use case
Hand a dataset and a training spec to an agent, get back metrics and a plot. Thecode-interpreter template exists for exactly
this — scikit-learn, pandas, numpy, matplotlib, seaborn are
pre-installed, so training starts in under a second without any
pip install detour.
Template
code-interpreter — rich scientific Python stack. Start this for
anything data-science-shaped.
Run it
Security policy
PIIConfig(enabled=True, rehydrate_response=True).
Network is OpenAI-only. Training on a local dataset doesn’t need
any other host; if someone tries to prompt-inject the agent into
calling an exfiltration endpoint, the connection will fail.
Env isolation
MODEL_FAMILY requires no prompt change — just env
changes — so the agent’s instructions stay deterministic.
What the agent does
printenv MODEL_FAMILY RANDOM_SEED DATASET.- Load
sklearn.datasets.{iris|wine|digits}. - Train the selected family (
logistic_regressionorrandom_forest) with seed $RANDOM_SEED. - Run 5-fold cross-validation.
- Save
/workspace/confusion.pngand/workspace/metrics.json(accuracy_mean,accuracy_std,classes,n_samples). - Return
cat /workspace/metrics.json.
Expected output
Full source
Seecookbook/openai_agents_ml_model.py in the repo.