OpenProgram Docs

Programs code structure

Everything the Agent can call is a Program.

Directory layout

openprogram/
├── runtime/agent/
│   ├── llm.py                  # llm(): one model call
│   ├── agent_function.py       # agent(): model tool-call loop
│   └── agent_class.py          # Agent: named roles with methods
└── programs/
    ├── __init__.py             # TOOLSETS, DEFAULT_TOOLS, agent_tools, apply_tool_policy
    ├── tools/                  # always given to the Agent
    │   ├── files/  code/  web/  interaction/  knowledge/  jobs/
    │   ├── agents/  computer_use/  runtime/  system/
    │   └── planning/           # todo/  plan_mode/  open_work/  goal/
    ├── applications/           # each enabled or disabled as a unit
    │   ├── browser/            # tabs and Pages
    │   ├── meeting/            # records, transcribes and summarizes calls
    │   ├── workflow_recording/ # the demonstration recorder
    │   └── office_editor/      # the ONLYOFFICE document editor
    ├── _authoring/             # imported by Program code: application_client,
    │                           # json_parsing, reports/, helpers ...
    └── _host/                  # loads and runs Programs; Program code never imports it
        ├── runtime.py          # @function and the shared tool registry
        ├── context.py          # ProgramContext, one per owner
        ├── registry.py         # loader for built-in, user and harness Programs
        └── packages.py  sources.py  execution.py  services.py  ui/ ...

~/.openprogram/programs/<name>/   # Python packages, applications, harness clones

Each capability has one implementation and one public import path. No functions/, workflows/ or packages/ under programs/, and no aliases for old paths.

Where a Program comes from

SourceHoldsLoads
Built-in toolsprograms/tools/Files, shell, search, planning, asking the user, memory, jobs, web, computer useAlways, and cannot be disabled one by one. Most through @function on import; a package with PROGRAM_ENTRIES through a ProgramContext owned by tool:<name>
Built-in applicationsprograms/applications/browser, workflow_recording, office_editor, each providing the named service the core reaches it through; meeting, an application package that reaches the host only through capabilities (Meetings)Only while enabled (openprogram programs enable|disable <name> or the Applications page). Context owner application:<name>
User Programs~/.openprogram/programs/Packages listing PROGRAM_ENTRIES, directories with application.json, harness clones recorded by openprogram programs installThrough the same contexts. Package contract: Workflows
Portable package sources

Project-local Programs record locations as relative paths scoped by programs, never relative to the chat working directory. An external installation binding connects the installed runtime to the source checkout. Only exact authorized package names join Python resolution, not the whole external directory. Rejection and publishing rules: Workflow package contract.

Primitives and Workflows

EntryMeaningLocation
llm()One model call, structured output, no tool loopruntime/agent/llm.py
agent()Multi-round model tool-call loopruntime/agent/agent_function.py
AgentNamed role whose methods run model calls and can be offered as toolsruntime/agent/agent_class.py
goal()Starts a chat Goal. Session state, not a primitiveprograms/tools/planning/goal/

A Workflow is ordinary Python that defines flow, state and acceptance by calling these and other Programs. Anything that makes model calls, calls other Workflows, or keeps multi-stage state and completion checks is a Workflow, including a single model call wrapped in a role.

Goal runs as ordinary chat turns

AspectRule
One mechanismSession state in planning/goal/. After each successful chat turn, chat.py decides whether to start another for the active Goal. No separate Goal loop, judge Workflow or nested working agent.
Programs formgoal(prompt) takes only the objective, saves a chat Goal in the current conversation; the route starts the first turn through the same controls as /goal.
Chat and Agent/goal <objective> and the create_goal tool create the same Goal. The goal Program is never offered to agents as a tool.
Completionupdate_goal(status="complete") or a finished todo plan only submits a candidate. verification.py runs one independent read-only verification turn before the Goal is achieved.
LimitsNo round limit. Two automatic turns in a row without a tool call stop it as stalled. Optional token, active-time and cost limits are the only budgets.
RestartA Goal whose lease belonged to a previous worker comes back paused with a resume action (restart.py).

File or directory

FormWhenExample
Single .pyOne public entry and a few local helpers; readable on its owntools/files/edit.py
Same-name packageSeveral modules with distinct responsibilities, resource files or session adapterstools/planning/goal/, applications/browser/
Internal directory, _ prefixShared implementation serving only its neighbours; never a Programs UI nodeprograms/_authoring/, programs/_host/

File count and responsibility boundaries decide a split, not uniformity.

Permitted dependencies

CallerAllowedForbidden
ToolStandard library, approved dependencies, deterministic helpersllm(), agent(), Workflows, Applications
WorkflowTools, its own roles, other Workflows without cyclesDepending on Applications, copying other Workflows, dispatch by string name
ApplicationPublic Tools and Workflows, its own UI and servicesModifying the called Program or keeping a second implementation
Program codeprograms/_authoring/ and the public runtime APIprograms/_host/

Registration and Programs UI

AspectRule
Registration_host/registry.py loads built-in tools, enabled built-in applications, the user's Programs and recorded harnesses. Each package registers through its own ProgramContext, kept by owner (tool:<name>, application:<name>, the package's name, external:<package>). Unloading or reloading disposes it and everything it added.
Programs treeMirrors source directories only. A registered entry is runnable and shows Use. Expanding a same-name package lists its modules from the actual directory (goal/command.py), readable but not extra Programs. __init__.py and _ directories never become nodes.
Stable contractMoving source does not change public names, parameter schemas, permissions, DAG semantics or session state formats. Old paths fail directly: no aliases, no dual scanning.

Excluded

  • No @workflow decorator; directories and metadata express classification.
  • No call_workflow(name); Workflows use ordinary Python imports and calls.
  • No versioned old and new directories, and no runtime choice between them.

Dynamic tool argument mappings

Canonical schemas distinguish mappings whose keys arrive at invocation time from objects with declared fields.

Canonical objectLocal validationProvider tool mode
Anonymous mapping, Python dict or MappingAccepts dynamic keys; enforces object and declared value typesMapping schema, non-strict
Declared fields, even an empty set, or explicit additionalProperties: falseRequired fields, types, closed-field rejection. Never opened.Strict where supported
Request with both kindsEach call against its own schemaMode per tool; strict is never disabled request-wide
  • program.args accepts a registered program's legal keyword arguments, including task. Nullable mappings keep their null behavior.
  • models/providers/schema/strict.py refuses to make a schema with dynamic keys strict, so an open mapping never becomes an empty closed object.
  • OpenAI strict mode needs closed objects: dynamic-mapping tools send strict: false on Responses, Codex and Chat Completions; fixed-field tools stay strict.
  • Anthropic is per tool too: mapping tools keep the ordinary input schema without the strict flag.
  • The fixed execute_code schema stays strict.

Implementation status: everything on this page is implemented.

Application runtime

Last updated · 2026-11-25