# Agentic workflows

An agentic workflow, called a **harness** or **agentic program** in code, is a git repository of `Agent` methods built with [Agentic Programming](https://fzkuji.github.io/OpenProgram/docs/capabilities/agentic-programming/README.html). Releases bundle none. Installed ones appear in chat, on the Web UI Programs page, and in `openprogram programs run`.

## Commands

| Command | Effect |
| --- | --- |
| `openprogram programs list` | Every Program: tools, applications, your packages, harnesses. Each Workflow in `~/.openprogram/programs` is a `package` row with entries and state: `loaded`, `error`, or `pending` (not callable yet: no commit has passed the check). |
| `openprogram programs install <owner>/<repo>` | Any harness; a git URL or directory also works. Clones it, installs declared dependencies, records the approved source. Mutable environments only: a source checkout or CLI/server installation. The packaged desktop runtime refuses. |
| `openprogram programs install <ref> --upgrade` | Reinstall or upgrade |
| `openprogram programs uninstall <name>` | Set a harness aside |
| `openprogram programs run <name> -a key=value` | Run directly. `--provider` (auto-detected by default) and `--model` override the model. |

## Workflows the agent writes

Worth it for a stable multi-stage structure, repeated use or reviewable history; not for a one-off. No special tools, just file tools and the command line:

1. Create `~/.openprogram/programs/<name>/` as a Git repository with roles, functions, `PROGRAM_ENTRIES`, `README.md` and behavior tests.
2. `openprogram programs check ~/.openprogram/programs/<name>` imports the package, runs tests in the OS sandbox, then on success commits and records that commit as checked.
3. On failure, read the report, fix, check again.

The worker loads the checked commit within seconds; entries appear as tools in every chat and on the Programs page without restart. Editing works the same way. Earlier versions stay in Git.

## Trigger

| From | How |
| --- | --- |
| Web form | **Use** in Programs or a sidebar favorite. A new-tab page becomes a draft chat; an existing chat keeps its draft and running task. Fill in requirements and send; opening or closing runs nothing. |
| Chat | Entries register as tools (`as_tool=True`). Describe the task and the model calls them, such as `paper_agent` from an installed `owner/paper-harness`. Operating apps, the screen, browser Pages and other machines is [`computer_use`](https://fzkuji.github.io/OpenProgram/docs/capabilities/computer-use.html), not a workflow. |
| Command line | `openprogram programs run paper_agent -a task="Survey recent work on agent memory"` |
| Python | Ordinary importable functions |

Forms ask for task information, never execution settings. Text polishing infers style from the text. Browser backend and session handles stay internal. Page ranges and output destinations are optional requirements. Explicit Python callers keep supported overrides.

## Model selection

| Case | Model |
| --- | --- |
| From a chat | Internal calls inherit the turn: per-turn override, then session selection, then agent profile. Also applies to tool subprocesses. |
| Direct tool run | Needs an explicit provider and model for internal calls; no global detection or provider default |
| Body calls no model | Runs with none configured |
| Unavailable model or credential | Fails when the body calls the Runtime, with that model's error. Model-free steps still run and no other provider is chosen. |

**Browser workflows**

Keep an explicit initial URL when a backend is selected. Official MCP backends support guarded waits and propagate snapshot failures. Page recovery stays in the current window scope and does not replay the failed action. A verified result keeps its actual evidence and observed target.

## Write your own

| Form | Guide |
| --- | --- |
| Harness: `<package>/agentics/__init__.py` exposing `PROGRAM_ENTRIES` | [Installing programs](https://fzkuji.github.io/OpenProgram/docs/capabilities/installing-programs.html) |
| Single package in `~/.openprogram/programs` | [Write and check a Workflow](https://fzkuji.github.io/OpenProgram/docs/capabilities/workflows/authoring.html) |
| Show the agent instead | [Record a workflow](https://fzkuji.github.io/OpenProgram/docs/capabilities/workflows/recording.html) |

## Weekly reports

If `weekly_report` is in your catalog, give it the report text or the change: submit this week's report, update only next week's plan, inspect the record, or draft locally at a named path.

**How it writes to Feishu**

- Reads the configured form and matches name and year/week before writing. A missing record is submitted once; an existing editable record is opened from history and saved. Partial updates keep untouched fields. Draft and read-only requests do not submit.
- Unknown inspection results, login failures and ambiguous records stop. A submission cap alone does not rule out editing.
- Success needs a fresh page confirmation and persisted values. Uncertain results are reported without retry. Ordinary browser authorization applies. Bounded browser steps, no `goal()` loop; never invents progress, metrics or paper titles.

**group_weekly_report**

`group_weekly_report(task)` prepares an unsent draft. Review and send it yourself.

| Topic | Behavior |
| --- | --- |
| Evidence | Scope, material and authors from memory, local files and WeChat |
| Gaps | No questions for missing fields; unknown authors and unavailable sources are listed. Missing material is not proof of non-submission |
| `source: "supplied"` | Restricts to supplied materials. Complete structured supplied-only inspection uses no model |
| Summaries | Bounded per-member contexts, checked references, explicit uncertainty |
| Files | `reports/group-weekly/<week>/<unique-run>/` or `output_dir` |

[Weekly reports](https://fzkuji.github.io/OpenProgram/docs/capabilities/workflows/reports.html)
