OpenProgram Docs

Agent execution core

Programs Workflow roles, Agent methods agent(), Agent current Runtime Sessions Chat, CLI, sub-agent, Job run_agent_turn() session, branch, Job, recovery, head, archive One Agent loop runtime/agent/loop → provider stream same retry, cancel, timeout, usage and Call events
  1. ProgramsWorkflow roles, Agent methodsagent(), Agent: current Runtime
  2. SessionsChat, CLI, sub-agent, Jobrun_agent_turn(): session, branch, Job, recovery, head, archive
  3. One Agent loopruntime/agent/loopsame retry, cancel, timeout, usage and Call events

Lifecycle before and after the loop is all that differs. No per-function decorator is needed: Agent scopes ordinary methods itself. agent(), agent_async() and Agent.arun share the core.

Primitives

PrimitiveMeansPersistent sessionDAG
llm()One logical model request, with structured output and its repair budgetNo, current RuntimeOne LLM Call
agent()Model and tool loop for one task; final text or a validated structured valueNo, current RuntimeAgent Call holding LLM and Function Calls
Workflow rolerole(prompt, context=) runs a tool loop; role.choose picks one optionNo, current RuntimeChild of the entry node, exact request stored
goal Program, create_goalKeeps an objective active across a conversation's turns until verification accepts it. Needs a conversation.Yes, saved in its sessionTurns, then a verification turn
run_agent_turn()Internal session lifecycle; not a Program primitiveYesIndependent Agent Call on a session branch

Workflow code calls the model only through roles. The contract is in Workflows; the Agent and Context owners are in Agent and Context contract.

Signature of agent()
def agent(
    prompt: str | list[dict],
    *,
    model=None, effort=None, tools=None, tools_deny=None,
    response_format=None, choices=None,
    max_iterations=None, stop_after_tool_round=False, timeout_s=None,
    tool_choice=None, parallel_tool_calls=None, execution_kind="agent",
    runtime=None, return_raw=False, toolset=None, tools_allow=None,
    instructions=None, context=None, tools_source=None,
    on_retry=None, web_search=None, stream_fn=None,
) -> Any: ...

No session_id, branch_from, advance_head, archive_when_done or run_in_background: persistence belongs to the execution environment. Saved Agent profiles go through Agent.from_spec, whose explicit overrides win.

Boundaries

Not addedInstead
A third Agent abstraction or a public wrapper over Jobsagent() and Agent
Workflow DSL or graph enginePython packages; static graphs from imports and entry identities
Second profile system or extra databaseExisting Agents profiles and stores
Hidden chain-of-thought in the UIModel-output summaries

Programs do not import runtime.conversation.peer_agents.sub_agent_run, except the sub-agent tools (programs/tools/agents/agent, send_message), its product entry.

Workflow lifecycle

StageWhoResultWhere to see it
WriteChat Agent with file toolsPackage in ~/.openprogram/programs/<name>/Tool calls in the chat
Checkopenprogram programs checkImport probe, sandboxed tests, Git commit on successReport (--json)
LoadWorker watcherEntries of the clean committed revision become toolsPrograms page, openprogram programs list
RunThe Workflow's codeEntry resultEntry node with one child per role call

What the UI shows

LevelCollapsedExpanded
WorkflowName, state, duration, step count, full ConclusionRole calls in order, each with its exact request and reply
AgentLabel, state, iterationsModel-output summaries, actual Program calls
Program CallName, argument summary, stateInput, output, errors, side-panel details
Sub-agent sessionNavigable rowSwitches to the child session; returning keeps the same row

Plain functions are not recorded. Children expand progressively, not all at once.

Failures

FailureHandlingUser sees
No native structured outputFalls back by capability to text JSON with local schema validationAn error stays on its LLM or Agent Call; Workflow failed
programs check failsNo commit; the chat Agent reads the report and editsCheck report in the chat
Worker restartSession and Job paths recover. A resumable entry resumes through step(). Other in-Program Agents end with the parent.No stale running state
User cancellationOne token reaches Runtime, provider and tools; children end before the parentCancelled or interrupted, never completed
Tool or child Workflow failureKeeps error payload, caller and partial artifactsFailed nodes and Conclusion agree

Invariants

  • Only PROGRAM_ENTRIES register as tools; category directories do not.
  • Each role call is a child of its entry node, and every Program a Workflow calls appears in the DAG.
  • A direct Workflow does not attach to the prior assistant through predecessor.
  • App, Web and TUI of one profile share one worker.
Focused tests
pytest -q tests/unit/programs/dag/test_runtime_exec_dag.py
pytest -q tests/component/agent/jobs/test_async_job_recovery.py
pytest -q tests/unit/agent/jobs/test_spawn_caller_invariant.py
pytest -q tests/component/webui/abilities/test_programs_explorer.py
Compared with other frameworks
ReferenceAdoptedNot adopted
OpenAI Agents SDK: running agentsA runner owns the loop of one logical turn; limits, sessions and hooks are separateA second runtime
OpenAI Agents SDK: toolsFunction tools and agent-as-tool are explicit; parents observe child executionTurning Workflows into handoffs
OpenAI Agents SDK: orchestrationCalling a child differs from handing over controlImplicit session branches from agent()
LangGraph: workflows and agentsWorkflows are predefined paths; Agents choose tools locallyA graph DSL
LangGraph: persistencePersistence and interruption recovery are explicit lifecycle capabilitiesA persistent thread for every in-Program Agent

Implementation status

StatusItems
Implementedllm(), agent() on the current Runtime; structured output; Workflow roles on the public core; programs check and loading; session adapter
Not yet verifiedDAG and Conclusion display after reload in the installed App
Last updated · 2026-11-25