Design philosophy
| Traditional agent | Agentic Programming | |
|---|---|---|
| Flow | LLM plans; a loop runs until it says done | Python code |
| Decisions | LLM judges every step, tool and argument | Python decides whether to call the LLM |
| State | Crammed into the context | Function variables, return values |
| Testing | Prompt regression | Unit 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
| Rule | Behaviour |
|---|---|
| DAG | Each Agent execution owns one. Chat records user messages, model requests and directly dispatched tools; ordinary helpers create no durable nodes. |
| Another Agent | An independent DAG; the parent stores the result and a child_session_id reference |
| Ownership | Permission, cancellation and file checkpoints stay with the originating execution |
llm() history | Rendered from the DAG, so context is a property you declare on the function |
expose | What a completed call reveals to its parent. "io" (name, input, output; default for tools), "full" default for ordinary methods. |
render_range | How 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
| Idea | Meaning |
|---|---|
| The LLM writes code | The 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 mode | A 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
| Scenario | LangChain, AutoGPT | Agentic Programming |
|---|---|---|
| Fetch 10 pages, summarize each | Agent decides order and parallelism | for url in urls: summarize(fetch(url)) |
| Context across 3 conversations | Memory store, queried each time | A local Python variable |
| LLM decides which tool | Function calling and agent loop | agent(prompt, tools=[...]) or decision.make(prompt, options) |
| Retry on error | Agent decides | try/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
| Path | Holds |
|---|---|
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