Skip to main content

Autonomous ML agent with cognitive loop

Project description

ML-Ralph

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

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


Download files

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

Source Distribution

ml_ralph-0.4.0.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

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

ml_ralph-0.4.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

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

Hashes for ml_ralph-0.4.0.tar.gz
Algorithm Hash digest
SHA256 89465ad4cdc21e786542701c4cdf3169a03706225c7068bc0bb610473f02a86d
MD5 944edb5e0ceb3f3a6f3b8a73d08956da
BLAKE2b-256 b8e75e2456279e323e6145633ca44338e96b413a595bad2dc473d602ac68f882

See more details on using hashes here.

Provenance

The following attestation bundles were made for ml_ralph-0.4.0.tar.gz:

Publisher: publish.yml on pentoai/ml-ralph

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

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

Hashes for ml_ralph-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc0715cf2337bbfba96ac24415852d0fe9813e0ae7be50d9e00ed03a0d724402
MD5 1fdcc5c24a5a319c152a604181bd20fe
BLAKE2b-256 3566b7bd3dab7eaf93e43e8d53303aae4637c2ad6a06d12f09da1d5cb414eb07

See more details on using hashes here.

Provenance

The following attestation bundles were made for ml_ralph-0.4.0-py3-none-any.whl:

Publisher: publish.yml on pentoai/ml-ralph

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