OpenProgram Docs

Design philosophy

Traditional agentAgentic Programming
FlowLLM plans; a loop runs until it says donePython code
DecisionsLLM judges every step, tool and argumentPython decides whether to call the LLM
StateCrammed into the contextFunction variables, return values
TestingPrompt regressionUnit tests

Handing control to a probabilistic black box, for work deterministic code could do, makes trajectories vary and histories balloon. Completion is not guaranteed, and a failure could come from the prompt, the tool or a hallucination.

So decompose the task into a function call graph and decide per node: plain Python, or an Agent method that calls llm(...) for understanding, generation or judgment. The LLM becomes something you call, constrain and compose.

Three primitives

Agent method

from openprogram import Agent
from openprogram.runtime.agent import llm

class ExampleAgent(Agent):
    method_options = {'summarize': {'tool': True}}

    def summarize(self, text: str) -> str:
        """Summarize a text in one sentence, preserving the core point."""
        return llm([{"type": "text", "text": (
            f"Summarize in one sentence, preserving the core point:\n\n{text}"
        )}])

_example_agent = ExampleAgent()
summarize = _example_agent.summarize

The docstring travels with the call as descriptive context; llm(...) makes one model call on the ambient Runtime. To callers, summarize(article) is any Python function.

Runtime

Packages the conversation history, calls the provider (Anthropic, OpenAI, Claude Code and others), writes the result into the context. Orchestration uses llm(); Runtime.exec() is the lower-level embedding API under it.

Context

RuleBehaviour
DAGEach Agent execution owns one. Chat records user messages, model requests and directly dispatched tools; ordinary helpers create no durable nodes.
Another AgentAn independent DAG; the parent stores the result and a child_session_id reference
OwnershipPermission, cancellation and file checkpoints stay with the originating execution
llm() historyRendered from the DAG, so context is a property you declare on the function
exposeWhat a completed call reveals to its parent. "io" (name, input, output; default for tools), "full" default for ordinary methods.
render_rangeHow much history the function's own calls pull in. {"callers": 0} gives an isolated scratch context.

The same DAG is the debugging view: visualization, token accounting, replaying failure paths.

Derived ideas

IdeaMeaning
The LLM writes codeThe agent writes functions with ordinary file edits; no dedicated create() or fix() is needed. After openprogram programs check, the worker loads them from ~/.openprogram/programs/ without a restart. Code is data, the LLM the compiler, functions the product.
Dual modeA library you import and hand-write, and a product you ask in the CLI or WebUI. What you get is readable Python, so it can be understood incrementally.

Against traditional frameworks

ScenarioLangChain, AutoGPTAgentic Programming
Fetch 10 pages, summarize eachAgent decides order and parallelismfor url in urls: summarize(fetch(url))
Context across 3 conversationsMemory store, queried each timeA local Python variable
LLM decides which toolFunction calling and agent loopagent(prompt, tools=[...]) or decision.make(prompt, options)
Retry on errorAgent decidestry/except and code gates: validation catches an invalid pick, the model re-decides

Agent frameworks suit fully open-ended tasks with fuzzy goals.

Where the paradigm lives in the code
PathHolds
openprogram/runtime/agent/Engine
openprogram/runtime/context/Flat-DAG context
openprogram/models/LLM providers
openprogram/programs/Tools and applications written this way
apps/web/Web UI for running things without code

Paper, KDD 2026 AgenticSE workshop · Getting started · API reference · Design

Last updated · 2026-11-25