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
Primitive
Means
Persistent session
DAG
llm()
One logical model request, with structured output and its repair budget
No, current Runtime
One LLM Call
agent()
Model and tool loop for one task; final text or a validated structured value
No, current Runtime
Agent Call holding LLM and Function Calls
Workflow role
role(prompt, context=) runs a tool loop; role.choose picks one option
No, current Runtime
Child of the entry node, exact request stored
goal Program, create_goal
Keeps an objective active across a conversation's turns until verification accepts it. Needs a conversation.
Yes, saved in its session
Turns, then a verification turn
run_agent_turn()
Internal session lifecycle; not a Program primitive
Yes
Independent 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.
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 added
Instead
A third Agent abstraction or a public wrapper over Jobs
agent() and Agent
Workflow DSL or graph engine
Python packages; static graphs from imports and entry identities
Second profile system or extra database
Existing Agents profiles and stores
Hidden chain-of-thought in the UI
Model-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
Stage
Who
Result
Where to see it
Write
Chat Agent with file tools
Package in ~/.openprogram/programs/<name>/
Tool calls in the chat
Check
openprogram programs check
Import probe, sandboxed tests, Git commit on success
Report (--json)
Load
Worker watcher
Entries of the clean committed revision become tools
Programs page, openprogram programs list
Run
The Workflow's code
Entry result
Entry node with one child per role call
What the UI shows
Level
Collapsed
Expanded
Workflow
Name, state, duration, step count, full Conclusion
Role calls in order, each with its exact request and reply
Agent
Label, state, iterations
Model-output summaries, actual Program calls
Program Call
Name, argument summary, state
Input, output, errors, side-panel details
Sub-agent session
Navigable row
Switches to the child session; returning keeps the same row
Plain functions are not recorded. Children expand progressively, not all at once.
Failures
Failure
Handling
User sees
No native structured output
Falls back by capability to text JSON with local schema validation
An error stays on its LLM or Agent Call; Workflow failed
programs check fails
No commit; the chat Agent reads the report and edits
Check report in the chat
Worker restart
Session and Job paths recover. A resumable entry resumes through step(). Other in-Program Agents end with the parent.
No stale running state
User cancellation
One token reaches Runtime, provider and tools; children end before the parent
Cancelled or interrupted, never completed
Tool or child Workflow failure
Keeps error payload, caller and partial artifacts
Failed 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.