OpenProgram Docs

Self-programming AI agents

  1. The agent writes a Workflow package in ~/.openprogram/programs/<name>/ with its normal file tools.
  2. openprogram programs check tests it, commits it and records it as checked.
  3. The worker loads it without restarting; later turns call its entries from the same registry as existing tools.

Writing to the package is not refused; the check decides what runs. An edit or a plain git commit stays out of use until the check passes.

What the agent writes

from openprogram import Agent, Context

reviewer = Agent(instructions="You find concrete defects.", tools=[])
editor = Agent(instructions="You revise drafts.", tools=[])


def review_then_revise(draft: str) -> str:
    """Review a draft, then revise it against the review."""
    ctx = Context({"draft": draft})
    review = reviewer("Identify concrete defects in this draft", context=ctx)
    return editor("Revise the draft using the review",
                  context=ctx.derive({"review": review}))


PROGRAM_ENTRIES = [review_then_revise]

Python fixes the order; two roles do the semantic steps, each seeing only the blocks its Context holds.

Ask for one

curl -fsSL https://fzkuji.github.io/OpenProgram/install | sh
openprogram
Create a Workflow named review_then_revise. It must review a draft, revise it
against the review, return only the final text, and include a behavior test.

Controls that still apply

ControlWhere
Tool accessEach role's tools and the configured approval policy
RecordEach role call and its exact request, in the session graph
Limits, cancellation, structured output validation, provider accountingThe runtime
SourceOrdinary files with their own Git history: inspectable, testable, revertable. Only a checked commit loads, from an extracted copy that later edits cannot reach. If it fails to import, the version before it keeps running and the Program shows error with a note naming both.

When to use it

TaskUse
Repeated, needs a reusable and inspectable process, semantic steps need judgmentSelf-programming
Entirely deterministicA plain function
Already has a stable implementationAn existing tool

Write and check a Workflow · Agentic Programming guide · Agent reference · Design philosophy

Last updated · 2026-11-25