Sandbox
@ray-r-ren/agent-apprenticeship

CLI for agent loops, traces, and learning data

Agent Apprenticeship runs agents through real tasks, checks the output, and captures the work as traces, experience compilations, and training records. You can inspect that output locally, export it to the shared ecosystem, and install prior experience before the next run.

1,334 stars59 forksPythonUpdated 2mo ago
Who it's for

Builders who want their local agent runs to leave behind reusable traces and learning signals.

What it delivers

You can turn completed agent work into reusable experience that helps the next run do better.

What it does

Task loop runner

Runs a prompt through repeated execution loops with a chosen local agent.

Mentor evaluation

Lets mentor models, users, or human experts review and judge task output.

Experience compilation

Packages execution traces and lessons into reusable experience records.

Runtime training install

Installs prior experience so future runs can use accumulated signals.

Ecosystem import and export

Searches, inspects, pulls, and exports shared experience from the ecosystem.

Agent auto-detection

Detects installed agents like Codex, Cursor, Claude Code, OpenClaw, OpenCode, and Hermes Agent.

How to get it

  1. 1Run
    npx agent-apprenticeship init
  2. 2Or install globally
    npm install -g agent-apprenticeship
    apprentice init
  3. 3The installed command is
    apprentice
  4. 4The long-form command also remains available
    agent-apprenticeship
  5. 5Start Agent Apprenticeship
    npx agent-apprenticeship init
  6. 6Use defaults
    npx agent-apprenticeship init --defaults

README

Agent Apprenticeship

npm version HF Downloads

Real-world agent work experience, looped into collective learning.

The living ecosystem where AI agents complete tasks through workflow loops, improve through iterative execution, are evaluated by mentor agents or humans in the loop, and turn completed work into reusable work experience and data to improve future agents.

npx agent-apprenticeship init

Agent Apprenticeship

As agents move into long-horizon, economically valuable work, Agent Apprenticeship creates the open infrastructure where real-world tasks generate reusable learning signals and complex workflows advance through agent loops that turn execution into shared improvement.

Agent Apprenticeship is designed for a compounding exchange of agent work experience: economically valuable task execution generates training signals, those signals improve future work, and future work creates new reusable experience for the ecosystem.

Agent Apprenticeship is built for iterative workflow loops across domains, from simple tasks to complex specialized work. Apprentice agents work with mentor agents, users, or human experts to complete real-world tasks, while each workflow generates reusable learning signals for the ecosystem.

The latest seed dataset includes:

  • 500+ curated seed tasks sourced and grounded from the real world
  • 495 reusable agent lessons
  • 1000+ full agent execution traces
  • 1000+ agent work episodes / task rollouts
  • 505 full agent work experience compilations
  • 39k+ structured experience compilation records

The seed dataset spans specialized, economically valuable tasks across domains and forms the first layer of the Agent Apprenticeship ecosystem.

Agent Apprenticeship is now available for anyone to start using with local agents, including Codex, Cursor, Claude Code, OpenClaw, OpenCode, Hermes Agent, and custom agents, alongside different model providers. Users can run automated agent workflow loops locally, contribute agent learning signals back to the ecosystem, and use shared ecosystem signals to improve their own agents.

Agent Apprenticeship is about the future of work and the economic value of agents. For every task executed through Agent Apprenticeship, the system can estimate task-level economic value, especially across specialized domains. It is built for everyday use to improve agent performance and outcome quality, while enabling users to exchange agent work experience with each other and with domain-expert-led agents in one living ecosystem.

Install

npx agent-apprenticeship init

Or install globally:

npm install -g agent-apprenticeship
apprentice init

The installed command is:

apprentice

The long-form command also remains available:

agent-apprenticeship

Quickstart

Start Agent Apprenticeship:

npx agent-apprenticeship init

Use defaults:

npx agent-apprenticeship init --defaults

Check your setup:

apprentice settings
apprentice doctor

Configure your Apprentice Agent, Mentor Model Provider, and Apprenticeship Mode:

apprentice configure
apprentice configure model
apprentice settings

Apprenticeship Modes:

Autonomous
Expert-Led
Organization Custom

Store Mentor Model Provider keys in:

~/.agent-apprenticeship/.env.local

Example:

OPENAI_API_KEY=""
ANTHROPIC_API_KEY=""
GEMINI_API_KEY=""
OPENROUTER_API_KEY=""

You can also use shell environment variables for the current terminal session:

export OPENAI_API_KEY="..."
apprentice doctor

Run your first task:

apprentice run "Create a short market map for AI procurement tools."

Watch progress:

apprentice watch <run_id>

When the run completes, Agent Apprenticeship prints the local run folder and Experience Compilation path.

Inspect the generated Experience Compilation:

apprentice ecosystem inspect <experience_compilation_path>
apprentice bundle check <experience_compilation_path>

Export the Full Experience Compilation:

apprentice ecosystem export <experience_compilation_path> --full

Install Runtime Training from prior experience:

apprentice learn install <experience_compilation_path>

Use installed Runtime Training in a future run:

apprentice run "Create a release checklist for an AI agent project."

Configure maximum loop depth:

apprentice settings

For a one-off terminal session:

export AA_MAX_ITERATIONS=3

Apprentice Agents

Available Apprentice Agents:

Codex
Cursor
Claude Code
OpenClaw
OpenCode
Hermes Agent
Custom

Agent Apprenticeship auto-detects installed CLIs. If multiple are detected, choose one during setup.

Custom lets you provide a command template:

apprentice configure agent custom --command-template "my-agent run --workspace {workspace} --prompt-file {prompt_file}"

Mentor Model Providers

Store local keys in:

~/.agent-apprenticeship/.env.local

Example:

OPENAI_API_KEY=""
ANTHROPIC_API_KEY=""
GEMINI_API_KEY=""
OPENROUTER_API_KEY=""

Configure:

apprentice configure model
apprentice doctor

Public Ecosystem and Private Internal Only

Configure contribution mode:

apprentice settings

Modes:

Public Ecosystem
Private Internal Only

Explore ecosystem experience:

apprentice ecosystem search <query>
apprentice ecosystem inspect <id>
apprentice ecosystem pull <id>

Export Full Experience Compilation:

apprentice ecosystem export <id_or_path> --full

Install Runtime Training:

apprentice learn install <id_or_path>

Seed Dataset v0.2

Seed Dataset v0.2 is available on Hugging Face:

https://huggingface.co/datasets/Forsy-AI/agent-apprenticeship-seed-dataset_v0.2

It includes 505 full agent work experience compilations and 39k+ structured experience compilation records.

Selected ALE Tasks Demo

Selected ALE workflow-family mirrored transfer tasks are included under:

selected_ale_tasks_demo/

Public Repo Structure

bin/
src/
schemas/
examples/
selected_ale_tasks_demo/

Files in the repo

Repository payload10 top-level entries
  • bin
  • examples
  • schemas
  • selected_ale_tasks_demo
  • src
  • apprenticeship.png
  • LICENSE
  • package.json
  • pyproject.toml
  • README.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tools

JuliusBrussee/
caveman

🪨 why use many token when few token do trick — Claude Code skill that cuts 65% of tokens by talking like caveman

105k
1 add
MemPalace/
mempalace

The best-benchmarked open-source AI memory system. And it's free.

59k
stablyai/
orca

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

66k

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

132k

Never stop coding. Free MIT AI gateway: one endpoint, 352 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 550+ contributors

64k
headroomlabs-ai/
headroom

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

71k