Autonomous ML agent with cognitive loop
Project description
ML-Ralph
An autonomous ML agent that thinks like an experienced MLE. It works through a cognitive loop: ORIENT → RESEARCH → HYPOTHESIZE → EXECUTE → ANALYZE → VALIDATE → DECIDE.
Requirements
- Claude Code or Codex CLI
- A git repo for your ML project
Install
pip install ml-ralph
Or with uv:
uv tool install ml-ralph
Quick Start
1. Initialize Ralph in your project
ml-ralph init
2. Create a PRD with Claude Code
Open Claude Code and use the /ml-ralph skill:
/ml-ralph
Ralph will ask clarifying questions to understand your ML problem and create a PRD.
3. Run the Autonomous Loop
ml-ralph run
Ralph works through the cognitive loop until success criteria are met.
Project Structure
After running Ralph, your project will have:
your-project/
├── .ml-ralph/
│ ├── RALPH.md # Agent instructions
│ ├── prd.json # PRD (the contract)
│ ├── ralph.json # Execution state
│ ├── backlog.json # Hypotheses queue
│ ├── log.jsonl # Thinking log (research, learnings, analysis)
├── .claude/skills/ml-ralph/
├── .codex/skills/ml-ralph/
├── CLAUDE.md
└── AGENTS.md
Commands
| Command | Purpose |
|---|---|
ml-ralph init |
Initialize Ralph in current project |
ml-ralph run |
Run autonomous execution loop |
Options
# Use Claude Code (default)
ml-ralph run --tool claude
# Use OpenAI Codex
ml-ralph run --tool codex
# Codex with custom sandbox mode (default: workspace-write)
ml-ralph run --tool codex --sandbox danger-full-access
# Set max iterations (default: 100)
ml-ralph run --max-iterations 200
# Force overwrite on init
ml-ralph init --force
Codex Sandbox Modes
When using --tool codex, you can control the sandbox policy:
| Mode | Description |
|---|---|
read-only |
Agent can only read files, not modify |
workspace-write |
Agent can modify files in workspace (default) |
danger-full-access |
Full system access (use with caution) |
The Cognitive Loop
ORIENT → RESEARCH → HYPOTHESIZE → EXECUTE → ANALYZE → VALIDATE → DECIDE
↑ │
└─────────────────────────────────────────┘
- ORIENT: Understand the problem, constraints, failure modes
- RESEARCH: Learn from existing knowledge, find SOTA approaches
- HYPOTHESIZE: Form testable bets with expected outcomes
- EXECUTE: Implement minimal changes, run experiments
- ANALYZE: Understand results, examine failures, find patterns
- VALIDATE: Check for leakage, ensure results are trustworthy
- DECIDE: Keep/revert/pivot based on evidence
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 ml_ralph-0.4.0.tar.gz.
File metadata
- Download URL: ml_ralph-0.4.0.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89465ad4cdc21e786542701c4cdf3169a03706225c7068bc0bb610473f02a86d
|
|
| MD5 |
944edb5e0ceb3f3a6f3b8a73d08956da
|
|
| BLAKE2b-256 |
b8e75e2456279e323e6145633ca44338e96b413a595bad2dc473d602ac68f882
|
Provenance
The following attestation bundles were made for ml_ralph-0.4.0.tar.gz:
Publisher:
publish.yml on pentoai/ml-ralph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ml_ralph-0.4.0.tar.gz -
Subject digest:
89465ad4cdc21e786542701c4cdf3169a03706225c7068bc0bb610473f02a86d - Sigstore transparency entry: 868894739
- Sigstore integration time:
-
Permalink:
pentoai/ml-ralph@bb28beaa04c7960e326a539d02782d27dc47c04d -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/pentoai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb28beaa04c7960e326a539d02782d27dc47c04d -
Trigger Event:
release
-
Statement type:
File details
Details for the file ml_ralph-0.4.0-py3-none-any.whl.
File metadata
- Download URL: ml_ralph-0.4.0-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc0715cf2337bbfba96ac24415852d0fe9813e0ae7be50d9e00ed03a0d724402
|
|
| MD5 |
1fdcc5c24a5a319c152a604181bd20fe
|
|
| BLAKE2b-256 |
3566b7bd3dab7eaf93e43e8d53303aae4637c2ad6a06d12f09da1d5cb414eb07
|
Provenance
The following attestation bundles were made for ml_ralph-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on pentoai/ml-ralph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ml_ralph-0.4.0-py3-none-any.whl -
Subject digest:
fc0715cf2337bbfba96ac24415852d0fe9813e0ae7be50d9e00ed03a0d724402 - Sigstore transparency entry: 868894745
- Sigstore integration time:
-
Permalink:
pentoai/ml-ralph@bb28beaa04c7960e326a539d02782d27dc47c04d -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/pentoai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb28beaa04c7960e326a539d02782d27dc47c04d -
Trigger Event:
release
-
Statement type: