openadapt-agent 2.2.0__tar.gz → 2.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. openadapt_agent-2.2.2/CHANGELOG.md +18 -0
  2. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/PKG-INFO +196 -51
  3. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/README.md +189 -44
  4. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/docs/DESIGN.md +38 -6
  5. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/docs/DISTRIBUTION.md +5 -5
  6. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/docs/MAILBOX_CLI.md +1 -1
  7. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/docs/REPAIR.md +1 -1
  8. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/docs/examples/sandbox-results.json +1 -1
  9. openadapt_agent-2.2.2/docs/task-ledger-measurement.json +121 -0
  10. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/manifest.json +3 -3
  11. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/pyproject.toml +20 -7
  12. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/scripts/capture_sandbox_examples.py +1 -1
  13. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/scripts/check_dist.py +1 -1
  14. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/scripts/check_source_boundary.py +1 -1
  15. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/scripts/smoke_client.py +2 -3
  16. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/server.json +5 -4
  17. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/skills/openadapt-gui-write/SKILL.md +3 -5
  18. openadapt_agent-2.2.2/src/openadapt_agent/__init__.py +66 -0
  19. openadapt_agent-2.2.2/src/openadapt_agent/mcpb_entry.py +6 -0
  20. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/conftest.py +14 -0
  21. openadapt_agent-2.2.2/tests/ledger_demo.py +735 -0
  22. openadapt_agent-2.2.2/tests/test_admission_tools.py +312 -0
  23. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_approval.py +44 -0
  24. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_approval_flow.py +41 -1
  25. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_authoring.py +48 -12
  26. openadapt_agent-2.2.2/tests/test_authoring_native.py +327 -0
  27. openadapt_agent-2.2.2/tests/test_delegated_approval.py +157 -0
  28. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_distribution.py +29 -11
  29. openadapt_agent-2.2.2/tests/test_guard_tools.py +143 -0
  30. openadapt_agent-2.2.2/tests/test_ledger.py +651 -0
  31. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_mailbox.py +4 -4
  32. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_mcpb_entry.py +1 -1
  33. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_partner_kit.py +4 -34
  34. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_public_lifecycle.py +1 -1
  35. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_readme_commands.py +1 -1
  36. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_repair.py +3 -1
  37. openadapt_agent-2.2.2/tests/test_repair_branch.py +73 -0
  38. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_repair_e2e.py +32 -2
  39. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_sandbox.py +4 -4
  40. openadapt_agent-2.2.2/tests/test_shim.py +37 -0
  41. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/uv.lock +111 -16
  42. openadapt_agent-2.2.0/llms.txt +0 -65
  43. openadapt_agent-2.2.0/src/openadapt_agent/__init__.py +0 -26
  44. openadapt_agent-2.2.0/src/openadapt_agent/__main__.py +0 -6
  45. openadapt_agent-2.2.0/src/openadapt_agent/approval.py +0 -124
  46. openadapt_agent-2.2.0/src/openadapt_agent/attended.py +0 -427
  47. openadapt_agent-2.2.0/src/openadapt_agent/authoring.py +0 -1689
  48. openadapt_agent-2.2.0/src/openadapt_agent/bridge.py +0 -860
  49. openadapt_agent-2.2.0/src/openadapt_agent/bundles.py +0 -245
  50. openadapt_agent-2.2.0/src/openadapt_agent/cards.py +0 -346
  51. openadapt_agent-2.2.0/src/openadapt_agent/cli.py +0 -769
  52. openadapt_agent-2.2.0/src/openadapt_agent/contract.py +0 -926
  53. openadapt_agent-2.2.0/src/openadapt_agent/copy.py +0 -53
  54. openadapt_agent-2.2.0/src/openadapt_agent/flow_service.py +0 -51
  55. openadapt_agent-2.2.0/src/openadapt_agent/mailbox.py +0 -806
  56. openadapt_agent-2.2.0/src/openadapt_agent/mcp.py +0 -411
  57. openadapt_agent-2.2.0/src/openadapt_agent/mcpb_entry.py +0 -66
  58. openadapt_agent-2.2.0/src/openadapt_agent/repair.py +0 -724
  59. openadapt_agent-2.2.0/src/openadapt_agent/runner.py +0 -941
  60. openadapt_agent-2.2.0/src/openadapt_agent/runner_bind.py +0 -185
  61. openadapt_agent-2.2.0/src/openadapt_agent/runs.py +0 -381
  62. openadapt_agent-2.2.0/src/openadapt_agent/sandbox.py +0 -512
  63. openadapt_agent-2.2.0/src/openadapt_agent/seal.py +0 -210
  64. openadapt_agent-2.2.0/src/openadapt_agent/seal_cli.py +0 -276
  65. openadapt_agent-2.2.0/src/openadapt_agent/service.py +0 -556
  66. openadapt_agent-2.2.0/src/openadapt_agent/skill.py +0 -188
  67. openadapt_agent-2.2.0/src/openadapt_agent/tutorial.py +0 -169
  68. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/.github/CODEOWNERS +0 -0
  69. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/.github/dependabot.yml +0 -0
  70. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/.github/workflows/ci.yml +0 -0
  71. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/.github/workflows/codeql.yml +0 -0
  72. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/.github/workflows/dependency-review.yml +0 -0
  73. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/.github/workflows/release.yml +0 -0
  74. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/.github/workflows/secret-scan.yml +0 -0
  75. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/.gitignore +0 -0
  76. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/.gitleaks.toml +0 -0
  77. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/.mcpbignore +0 -0
  78. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/LICENSE +0 -0
  79. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/SECURITY.md +0 -0
  80. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/scripts/check_mcpb.py +0 -0
  81. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/scripts/check_release_artifacts.py +0 -0
  82. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/source-policy.public.json +0 -0
  83. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/fixtures/cloud-ts-signed-seal.json +0 -0
  84. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_attended_bridge.py +0 -0
  85. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_bridge.py +0 -0
  86. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_cards.py +0 -0
  87. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_cli.py +0 -0
  88. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_contract.py +0 -0
  89. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_mcp_server.py +0 -0
  90. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_repair_hold.py +0 -0
  91. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_runner.py +0 -0
  92. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_runs.py +0 -0
  93. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_sandbox_flow.py +0 -0
  94. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_seal.py +0 -0
  95. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_seal_cli.py +0 -0
  96. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_seal_e2e.py +0 -0
  97. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_service.py +0 -0
  98. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_skill.py +0 -0
  99. {openadapt_agent-2.2.0 → openadapt_agent-2.2.2}/tests/test_tutorial.py +0 -0
@@ -0,0 +1,18 @@
1
+ # CHANGELOG
2
+
3
+ Releases up to v2.2.0 are recorded in the [openadapt-agent repository](https://github.com/OpenAdaptAI/openadapt-agent/blob/main/CHANGELOG.md).
4
+
5
+ ## v2.2.2 (2026-11-14)
6
+
7
+ - Accept `openadapt-flow` 3.x. Flow 3 moved its vision stack to the `vision`
8
+ extra, so this package now requires `openadapt-flow[vision]>=2.2.0,<4`.
9
+
10
+ ## v2.2.1 (2026-10-18)
11
+
12
+ First release from the [OpenAdapt monorepo](https://github.com/OpenAdaptAI/OpenAdapt) (`packages/agent`). The MCP agent server now lives in `openadapt_flow.agent`; this package is a compatibility package over it, so `openadapt-agent` and `import openadapt_agent` keep working. It requires `openadapt-flow>=2.2.0,<3`.
13
+
14
+ ### Features
15
+
16
+ - The server reads the approval mode and can answer a waiting save as a delegated agent ([#1192](https://github.com/OpenAdaptAI/OpenAdapt/pull/1192)).
17
+ - After a step is repaired more than once, the server proposes a branch ([#1188](https://github.com/OpenAdaptAI/OpenAdapt/pull/1188)).
18
+ - The install docs use user scope and say what happens next ([#1230](https://github.com/OpenAdaptAI/OpenAdapt/pull/1230)).
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openadapt-agent
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary: Let your AI agent enter information in apps with no API and get back whether it saved (MCP and Agent Skills)
5
- Project-URL: Homepage, https://github.com/OpenAdaptAI/openadapt-agent
6
- Project-URL: Repository, https://github.com/OpenAdaptAI/openadapt-agent
7
- Project-URL: Documentation, https://github.com/OpenAdaptAI/openadapt-agent#readme
8
- Project-URL: Bug Tracker, https://github.com/OpenAdaptAI/openadapt-agent/issues
5
+ Project-URL: Homepage, https://github.com/OpenAdaptAI/OpenAdapt/tree/main/packages/agent
6
+ Project-URL: Repository, https://github.com/OpenAdaptAI/OpenAdapt/tree/main/packages/agent
7
+ Project-URL: Documentation, https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/agent/README.md
8
+ Project-URL: Bug Tracker, https://github.com/OpenAdaptAI/OpenAdapt/issues
9
9
  Author-email: Richard Abrich <richard@openadapt.ai>
10
10
  Maintainer-email: OpenAdaptAI <contact@openadapt.ai>
11
11
  License-Expression: MIT
@@ -24,7 +24,7 @@ Requires-Dist: anyio>=4.0
24
24
  Requires-Dist: cryptography>=50.0.0
25
25
  Requires-Dist: jsonschema>=4.20.0
26
26
  Requires-Dist: mcp<3,>=1.28
27
- Requires-Dist: openadapt-flow<3,>=2.1.0
27
+ Requires-Dist: openadapt-flow[vision]<4,>=2.2.0
28
28
  Provides-Extra: dev
29
29
  Requires-Dist: build>=1.2.0; extra == 'dev'
30
30
  Requires-Dist: pytest>=8.0.0; extra == 'dev'
@@ -32,19 +32,21 @@ Requires-Dist: ruff>=0.4.0; extra == 'dev'
32
32
  Provides-Extra: repair-screens
33
33
  Requires-Dist: openadapt-privacy[presidio]>=1.1.2; extra == 'repair-screens'
34
34
  Provides-Extra: tutorial
35
- Requires-Dist: openadapt-flow[browser,macos]<3,>=2.1.0; extra == 'tutorial'
35
+ Requires-Dist: openadapt-flow[browser,macos,vision]<4,>=2.2.0; extra == 'tutorial'
36
36
  Description-Content-Type: text/markdown
37
37
 
38
38
  # OpenAdapt Agent
39
39
 
40
- [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](LICENSE)
41
- [![Python 3.10–3.12](https://img.shields.io/badge/python-3.10%E2%80%933.12-blue)](https://www.python.org/downloads/)
40
+ [![Packages CI](https://github.com/OpenAdaptAI/OpenAdapt/actions/workflows/packages.yml/badge.svg)](https://github.com/OpenAdaptAI/OpenAdapt/actions/workflows/packages.yml)
41
+ [![PyPI](https://img.shields.io/pypi/v/openadapt-agent)](https://pypi.org/project/openadapt-agent/)
42
+ [![Python](https://img.shields.io/pypi/pyversions/openadapt-agent)](https://pypi.org/project/openadapt-agent/)
43
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green)](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/agent/LICENSE)
42
44
 
43
45
  Your AI agent decides what to enter. OpenAdapt enters it in the app and checks that it saved.
44
46
 
45
47
  Use it if your agent reads referrals, intake forms, or authorizations and works out what belongs in the record, but a person still types the result into an app with no usable API. Examples are an electronic medical record (EMR) and a payer portal. This package is the tool your agent calls to do that typing.
46
48
 
47
- - A person or your agent shows OpenAdapt the task in the real app. OpenAdapt replays those steps, and by default a run makes no AI model calls.
49
+ - A person or your agent shows OpenAdapt the task in the real app. OpenAdapt replays those steps, and by default a run makes no calls to a hosted AI model.
48
50
  - Before it types, OpenAdapt checks that the right record is open. After it saves, it reads the record back.
49
51
  - Your agent gets one of four outcomes: done and checked, stopped before saving, check the record, or didn't run. When OpenAdapt can't confirm a save, it says so, and a person checks the record.
50
52
  - It runs on your customer's computer, one that can already open the app. Your agent, or a small program acting for it, has to run on that computer too, since it starts OpenAdapt and talks to it directly. If your agent runs in your own cloud, ask us about a hosted route.
@@ -71,7 +73,7 @@ openadapt-agent emit-skill <bundle> --out ~/.claude/skills
71
73
  | Type the values and save | Staff, retyping your agent's output | OpenAdapt, in the same screens staff use |
72
74
  | Confirm the save | Staff, if they look again | OpenAdapt reads the record back before it reports done |
73
75
  | Something doesn't match | Staff notice while typing, or someone finds it later | OpenAdapt stops before saving, and the run waits for a person |
74
- | What staff handle | Every document | Runs that stopped and records to check. Nobody is notified, so someone checks the list of stopped runs. |
76
+ | What staff handle | Every document | Runs that stopped and records to check. For work in a [task-ledger job](#track-a-long-job), each one is a question on their phone or desktop; otherwise someone checks the list of stopped runs. |
75
77
 
76
78
  For scale, two hospital time studies put keying one faxed referral into an electronic record at about 10 to 12 minutes ([UCSF, JAMIA Open 2020](https://pmc.ncbi.nlm.nih.gov/articles/PMC7660949/); [Calderdale and Huddersfield NHS Foundation Trust, HFMA 2024](https://www.hfma.org.uk/system/files/2024-04/Using%20digital%20technologies%20to%20process%20admin%20tasks%20Case%20Study%20v7.pdf)). We don't publish a time-saved number until a deployment measures one.
77
79
 
@@ -90,28 +92,30 @@ flowchart LR
90
92
 
91
93
  | You build | OpenAdapt provides |
92
94
  | --- | --- |
93
- | The agent that reads documents and decides what to enter | A workflow built from one recording of a person doing the task in the real app |
95
+ | The agent that reads documents and decides what to enter | A workflow learned from one or more demonstrations in the real app, where a person or an agent shows the task |
94
96
  | The call to `run_workflow`, with your own `request_id` | The run on your customer's computer, with a right-record check before it types and a record check after it saves |
95
97
  | What your product does with each outcome | One result per request, and no second entry when your agent repeats a `request_id` |
96
98
  | Your tests against the four outcomes | A sandbox that returns each outcome on demand |
97
99
 
98
- Your customer provides the computer and a person for runs that stop. Someone who does the task today records it, or your agent drives the recording. A person accepts the result before it runs, and on native Windows apps, Citrix and remote desktop a person has to do the recording. Your agent can guide that recording (see [Record a first workflow](#record-a-first-workflow)), or [talk to us](https://openadapt.ai/qualify?why=embed) about setting it up.
100
+ Your customer provides the computer and a person for runs that stop. A person or an agent shows the task, in web apps, native Windows apps, and remote-desktop sessions. A person accepts the result before it runs. See [Record a first workflow](#record-a-first-workflow), or [talk to us](https://openadapt.ai/qualify?why=embed) about setting it up.
99
101
 
100
102
  ## Try it in three steps
101
103
 
102
104
  The sandbox is a practice server that needs no account. It has one workflow, `add_triage_note`, which adds a note to the first referral in MockMed, a test clinic app with made-up patients.
103
105
 
104
- You need [Claude Code](https://claude.com/claude-code) (signed in), [uv](https://docs.astral.sh/uv/), and git. To use a different client or your own code, see [Connect your own agent](#connect-your-own-agent).
106
+ You need [Claude Code](https://claude.com/claude-code) (signed in) and [uv](https://docs.astral.sh/uv/). To use a different client or your own code, see [Connect your own agent](#connect-your-own-agent).
105
107
 
106
- 1. Add the sandbox server. Claude Code saves it for the current folder only.
108
+ 1. Register the sandbox server. `--scope user` makes it available in every folder; without it, Claude Code saves it for the current folder only.
107
109
 
108
110
  ```bash
109
- claude mcp add openadapt -- uvx --python 3.12 --from git+https://github.com/OpenAdaptAI/openadapt-agent openadapt-agent serve
111
+ claude mcp add --scope user openadapt -- uvx --python 3.12 openadapt-agent serve
110
112
  ```
111
113
 
112
- 2. In the same folder, start Claude Code with `claude`. Claude Code starts the server.
114
+ This only registers the server. It prints one line saying the server was added to user config, and nothing else.
113
115
 
114
- 3. Ask: "Use OpenAdapt to add the triage note 'Synthetic: recheck blood pressure in 2 weeks' with request id demo-0001."
116
+ 2. Start Claude Code with `claude`. Claude Code starts the server. Optional: type `/mcp` to check that `openadapt` is connected.
117
+
118
+ 3. Ask: "Use the OpenAdapt sandbox to run add_triage_note with the note 'Synthetic: recheck blood pressure in 2 weeks' and request id demo-0001."
115
119
 
116
120
  Your agent should call `list_workflows`, then `run_workflow` with these arguments:
117
121
 
@@ -136,17 +140,17 @@ The result looks like this (some fields left out):
136
140
 
137
141
  This install simulates each run without opening MockMed, and every result says so. To watch the real engine do the work, see [Drive MockMed with the real engine](#drive-mockmed-with-the-real-engine).
138
142
 
139
- Version 2.1.0 on PyPI includes the sandbox, so step 1 can also be `claude mcp add openadapt -- uvx --python 3.12 openadapt-agent serve`.
143
+ openadapt-agent installs from PyPI and requires openadapt-flow 2.1.0 or later, which is on PyPI and installs with it. To try unreleased changes, use `--from git+https://github.com/OpenAdaptAI/OpenAdapt#subdirectory=packages/agent` in place of the package name.
140
144
 
141
145
  ### See every outcome
142
146
 
143
- Ask for each case by adding `sandbox_case` to the inputs, with a new `request_id` each time. For example: "Now try the false_saved_banner case with request id demo-0002."
147
+ Ask for each case by adding `sandbox_case` to the inputs, with a new `request_id` each time. For example: "Now try the duplicate_record case with request id demo-0002."
144
148
 
145
149
  | `sandbox_case` | `outcome` | What MockMed does |
146
150
  | --- | --- | --- |
147
151
  | `normal` (default) | `done` | Saves the note, and the record check finds it. |
148
152
  | `duplicate_record` | `needs_review` | Lists the same referral twice, so OpenAdapt can't tell which record to open. It stops before saving. |
149
- | `false_saved_banner` | `not_sure_if_saved` | Shows a saved message, but the note wasn't stored. |
153
+ | `false_saved_banner` | `not_sure_if_saved` | Rejects the note on save, so it isn't stored. |
150
154
  | `timeout_after_save` | `not_sure_if_saved` | Saves the note, then times out with an error. |
151
155
  | `app_offline` | `did_not_run` | Doesn't answer, so nothing starts. |
152
156
 
@@ -154,11 +158,11 @@ The sandbox remembers each `request_id` across sessions. Sending a used `request
154
158
 
155
159
  ### Drive MockMed with the real engine
156
160
 
157
- The `tutorial` extra makes openadapt-flow (Flow), the engine behind OpenAdapt, drive MockMed in a hidden browser. Replace the sandbox server with this one:
161
+ The `tutorial` extra makes openadapt-flow (Flow), the engine behind OpenAdapt, drive MockMed in a hidden browser. Replace the sandbox server with this one, then restart `claude`:
158
162
 
159
163
  ```bash
160
164
  claude mcp remove openadapt
161
- claude mcp add openadapt -- uvx --python 3.12 --from 'openadapt-agent[tutorial] @ git+https://github.com/OpenAdaptAI/openadapt-agent' openadapt-agent serve
165
+ claude mcp add --scope user openadapt -- uvx --python 3.12 --from 'openadapt-agent[tutorial]' openadapt-agent serve
162
166
  ```
163
167
 
164
168
  When the server starts, Flow records the workflow once and, if needed, downloads a browser (about 300 MB). The first request waits for that. In our test on a Mac, the first request took about 80 seconds. The call returned `running` after 60 seconds, and the agent called `get_run` for the result. If setup takes more than 15 minutes, the request ends `did_not_run`. With Flow, a `done` result has `proof: "local"` instead of `"simulated"`.
@@ -177,6 +181,8 @@ The simulated sandbox suggests the same command in its `list_workflows` result.
177
181
  | `did_not_run` (Didn't run) | This call wrote nothing. With `request_id_conflict`, an earlier request with the same `request_id` may have saved. | If `safe_to_retry` is true, fix the cause and resend the same request. Otherwise follow `next_action`. |
178
182
  | `running` (Running) | The run didn't finish within `wait_seconds` (default 60). | Call `get_run` with the `run_id` until `outcome` changes. |
179
183
 
184
+ `checked_how` says how the save was checked, when the run recorded it: `system_of_record` (Checked in your system's records), `separate_session` (Checked in a separate session), `reopened` (Reopened in the same session), `same_screen` (The screen said it saved), or `unchecked`. Only `separate_session` or stronger makes a run `done`. A save that was confirmed only by reopening it in the same session, or on the screen it left, is `not_sure_if_saved` with reason `checked_below_minimum`. A workflow can require `system_of_record`.
185
+
180
186
  Branch on `outcome` and `safe_to_retry`. `next_step` names the next move as a fixed code, so your code doesn't have to parse `next_action`: `none`, `call_get_run`, `wait_for_person`, `check_record`, `fix_inputs`, `fix_setup`, or `retry`.
181
187
 
182
188
  ### Resend a request
@@ -194,7 +200,7 @@ The check that stops a second entry covers one runs folder. See `--runs-dir` und
194
200
  ### Read the other fields
195
201
 
196
202
  - `label`: a short status you can display, such as "Done and checked".
197
- - `reason`: a code from a fixed list that names the cause, such as `invalid_input` or `request_id_conflict`. Every code is in `REASONS` in [contract.py](src/openadapt_agent/contract.py), and [docs/DESIGN.md](docs/DESIGN.md#the-result-contract) explains how each one is chosen.
203
+ - `reason`: a code from a fixed list that names the cause, such as `invalid_input` or `request_id_conflict`. Every code is in `REASONS` in [contract.py](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/openadapt_flow/agent/contract.py), and [docs/DESIGN.md](docs/DESIGN.md#the-result-contract) explains how each one is chosen.
198
204
  - `what_happened` and `next_action`: fixed sentences you can show a person. They never contain input values or screen text.
199
205
  - `proof`: `local` for a `done` that was checked on your customer's computer, `simulated` for a sandbox run that didn't open the app, and `none` for every other outcome.
200
206
  - `model_calls`: on runs that reached Flow, how many AI model calls the run made. It's 0 unless model grounding, a fallback that asks an AI model where to click, is turned on (see [Security](#security)).
@@ -217,7 +223,7 @@ The sandbox has all three tools. With your own workflows, `run_workflow` appears
217
223
 
218
224
  ## Developer setup
219
225
 
220
- The package is a local Model Context Protocol (MCP) server that talks over stdio, plus an `openadapt-agent` command. It needs Python 3.10 to 3.12. It checks inputs, stops second entries, and turns Flow's report into one of the four outcomes. [openadapt-flow](https://github.com/OpenAdaptAI/openadapt-flow) records, replays, and checks the workflows.
226
+ The package is a local Model Context Protocol (MCP) server that talks over stdio, plus an `openadapt-agent` command. It needs Python 3.10 to 3.12. It checks inputs, stops second entries, and turns Flow's report into one of the four outcomes. [openadapt-flow](https://github.com/OpenAdaptAI/OpenAdapt/tree/main/packages/flow) records, replays, and checks the workflows.
221
227
 
222
228
  To see Flow on its own, install the OpenAdapt launcher with `pip install openadapt`, then run `openadapt flow tutorial` or `openadapt quickstart --break-it`.
223
229
 
@@ -230,7 +236,7 @@ Any MCP client can start the server with the command `uvx`. In a client that rea
230
236
  "mcpServers": {
231
237
  "openadapt": {
232
238
  "command": "uvx",
233
- "args": ["--python", "3.12", "--from", "git+https://github.com/OpenAdaptAI/openadapt-agent", "openadapt-agent", "serve"]
239
+ "args": ["--python", "3.12", "openadapt-agent", "serve"]
234
240
  }
235
241
  }
236
242
  }
@@ -247,8 +253,7 @@ from mcp.client.stdio import stdio_client
247
253
 
248
254
  SERVER = StdioServerParameters(
249
255
  command="uvx",
250
- args=["--python", "3.12", "--from", "git+https://github.com/OpenAdaptAI/openadapt-agent",
251
- "openadapt-agent", "serve"],
256
+ args=["--python", "3.12", "openadapt-agent", "serve"],
252
257
  )
253
258
 
254
259
 
@@ -270,10 +275,12 @@ asyncio.run(main())
270
275
 
271
276
  The SDK starts the server with only a few environment variables. To pass others, such as `OPENADAPT_BUNDLE_KEY`, add `env=` to `StdioServerParameters`.
272
277
 
278
+ To let your agent add workflows itself, see [Teach a new workflow from your agent](#teach-a-new-workflow-from-your-agent).
279
+
273
280
  [scripts/smoke_client.py](scripts/smoke_client.py) is a fuller example that runs every sandbox case. From a clone of this repository, run `pip install -e .`, then:
274
281
 
275
282
  ```bash
276
- python scripts/smoke_client.py -- uvx --python 3.12 --from git+https://github.com/OpenAdaptAI/openadapt-agent openadapt-agent serve
283
+ python scripts/smoke_client.py -- uvx --python 3.12 openadapt-agent serve
277
284
  ```
278
285
 
279
286
  If your agent runs in your own cloud, it can't reach this server, which has no network listener. The program that starts the server has to run on your customer's computer. One way to do that is a small worker there: it takes requests from your service over a connection it opens, starts this server, calls `run_workflow`, and sends each result back. The worker acts as your agent, so protect its connection like any other route to patient data. For a hosted route instead, [talk to us](https://openadapt.ai/qualify?why=embed).
@@ -291,7 +298,7 @@ A bundle is a compiled workflow folder that contains `workflow.json`, or `workfl
291
298
 
292
299
  `openadapt-agent serve --allow-run` is the older form of `--mode production`, or of the sandbox when there's no `--bundles`.
293
300
 
294
- Each run goes through `openadapt-flow run`. Flow drives web apps in Chromium, with the address set by `--url`. It also drives desktop apps and RDP and Citrix sessions, which can need Flow's own target flags passed with `--extra-run-arg`. The [openadapt-flow README](https://github.com/OpenAdaptAI/openadapt-flow#readme) covers each kind of app.
301
+ Each run goes through `openadapt-flow run`. Flow drives web apps in Chromium, with the address set by `--url`. It also drives desktop apps and RDP and Citrix sessions, which can need Flow's own target flags passed with `--extra-run-arg`. The [openadapt-flow README](https://github.com/OpenAdaptAI/OpenAdapt/tree/main/packages/flow) covers each kind of app.
295
302
 
296
303
  ### Get a workflow ready to run
297
304
 
@@ -303,7 +310,7 @@ What Flow requires depends on the profile set in the deployment config (`--confi
303
310
  - `standard` or `regulated`: certification, an active admission (a signed readiness test) for that exact bundle version, and a record check that reads the saved record through a separate path, such as the app's API, its database, or a second session. Under `standard`, a Citrix session with no separate way to read the record can't end `done`.
304
311
  - `demo`: no certification, but Flow doesn't confirm the save, so a finished run ends `not_sure_if_saved`.
305
312
 
306
- Flow's [execution profiles](https://github.com/OpenAdaptAI/openadapt-flow/blob/main/docs/EXECUTION_PROFILES.md) page explains each profile.
313
+ Flow's [execution profiles](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/docs/EXECUTION_PROFILES.md) page explains each profile.
307
314
 
308
315
  ### Set server options
309
316
 
@@ -311,10 +318,13 @@ Flow's [execution profiles](https://github.com/OpenAdaptAI/openadapt-flow/blob/m
311
318
  | --- | --- |
312
319
  | `--runs-dir DIR` | Where run records and Flow's evidence go. The default is `~/.openadapt/runs` (or `OPENADAPT_AGENT_RUNS_DIR` when it's set), never the folder where the client starts the server; the sandbox uses `~/.openadapt/agent-sandbox`. The server prints the folder it uses when it starts. The check that stops a second entry covers one runs folder, so give every server for the same work the same folder. Earlier versions used `./runs`; if that folder holds their records and you don't pass `--runs-dir`, the server won't start, so you choose which folder to keep. |
313
320
  | `--url URL` | The app's address, passed to every Flow run. |
314
- | `--config YAML` | Flow's deployment config ([example](https://github.com/OpenAdaptAI/openadapt-flow/blob/main/docs/deployment.example.yaml)), which sets the profile and whether model grounding is allowed. |
321
+ | `--config YAML` | Flow's deployment config ([example](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/docs/deployment.example.yaml)), which sets the profile and whether model grounding is allowed. |
315
322
  | `--policy NAME-OR-PATH` | The policy Flow certifies against, such as `clinical-write` or `permissive`. |
316
323
  | `--timeout SECONDS` | How long one run may work (default 600). Time a person spends approving a save doesn't count. A run stopped at the limit is `not_sure_if_saved`. |
317
- | `--approval-mode MODE` | Whether a person approves each save. Without it, Flow decides: under `standard` and `regulated` a run stops before each save until a person approves it (`each_item`). `not_gated` turns that off for every run this server starts; each result records it under `technical.approval_mode`. |
324
+ | `--approval-mode MODE` | Whether each save waits for approval. Without it, Flow decides, and a run stops before each save until it's approved (`each_item`). `not_gated` turns that off for every run this server starts; each result records it under `technical.approval_mode`. |
325
+ | `--delegate-approvals AGENT_ID` | Lets your agent answer a waiting save as `AGENT_ID` (an opaque id such as `agent:intake-bot`), with `list_approval_requests` and `answer_approval_request`. Flow accepts the answer only where the run's approver policy allows an agent for that step, and records the agent as the approver. By default only a person may answer. Needs openadapt-flow 2.2.0 or later. |
326
+ | `--admissions DIR` | Adds `prepare_admission`, `list_admissions` and `decide_admission`, the same steps as `openadapt-flow admit`, over recordings in `DIR/recordings` and shadow candidates in `DIR/shadow-candidates`. A person decides in your client's form. With `--delegate-approvals` and `--approver-grant`, your agent decides as that approver instead, under a grant a person signed that names it. It never decides an admission it prepared or one prepared on a server without `--delegate-approvals`, and never under the `regulated` policy pack. Accepting sets the workflow's runs to `problems_only`. The record names who decided, and for your agent the grant and who signed it. |
327
+ | `--approver-grant FILE` | With `--admissions` and `--delegate-approvals`: the approver grant a person signed (`openadapt-flow approver-grant sign`) that lets your agent decide admissions. Flow checks it on every decision. Without it only a person decides. |
318
328
  | `--headed` | Shows the browser. A person needs it to continue or skip a stopped run in a web app. |
319
329
  | `--extra-run-arg ARG`, `--flow-cli CMD` | Change how Flow is called. Either one can relax Flow's checks, for example `--extra-run-arg=--allow-unencrypted`. |
320
330
  | `--allow-protected-export`, `--allow-synthetic-recorded-defaults`, `--allow-model-grounding` | Off by default. See [Security](#security). |
@@ -323,17 +333,17 @@ Callers can't change `--url`, `--config`, `--policy`, `--timeout`, or `--approva
323
333
 
324
334
  ### Runs that wait for a person's approval
325
335
 
326
- Under `standard` and `regulated`, Flow stops before each save and waits for a person to approve it (up to 15 minutes by default). While it waits, `run_workflow` and `get_run` return `needs_review` with reason `waiting_for_approval` and `record_changed: "unknown"`, because an earlier save in the same run may have gone through. The person sees the waiting save with `openadapt-flow item-approval show RUN_DIR`, where `RUN_DIR` is the `run_id` folder in the runs folder, and answers with `item-approval approve` or `decline`. If nobody answers in time, the run stops before saving and reads `needs_review` with reason `approval_needed`. This server has no tool that approves a save: a person does.
336
+ Unless the operator names another `--approval-mode`, Flow stops before each save and waits for an answer (up to 15 minutes by default). While it waits, `run_workflow` and `get_run` return `needs_review` with reason `waiting_for_approval` and `record_changed: "unknown"`, because an earlier save in the same run may have gone through. The person sees the waiting save with `openadapt-flow item-approval show RUN_DIR`, where `RUN_DIR` is the `run_id` folder in the runs folder, and answers with `item-approval approve` or `decline`. If nobody answers in time, the run stops before saving and reads `needs_review` with reason `approval_needed`. `get_approval_mode` reports the mode and whether your agent may answer. With `--delegate-approvals`, your agent can list waiting saves with `list_approval_requests` and answer one with `answer_approval_request`, where the run's approver policy allows an agent for that step; otherwise a person answers.
327
337
 
328
338
  ### Use the other tools
329
339
 
330
340
  With `--bundles`, the server also registers read-only tools for workflows and runs: `get_workflow`, `get_run_report`, `list_needs_attention`, and `get_attention_item`. With `--mode production` or `--mode attended`, it also registers a deprecated `run_workflow_<id>` for each workflow. Those tools take no `request_id`, so a retry can enter the values twice. Use `run_workflow` instead.
331
341
 
332
- `list_workflows`, `run_workflow`, and `get_run` return `structuredContent` that matches their `outputSchema`, defined in [contract.py](src/openadapt_agent/contract.py), plus the same JSON as text.
342
+ `list_workflows`, `run_workflow`, and `get_run` return `structuredContent` that matches their `outputSchema`, defined in [contract.py](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/openadapt_flow/agent/contract.py), plus the same JSON as text.
333
343
 
334
344
  ### Decide stopped runs
335
345
 
336
- A run that stops for a person waits in Flow's Needs Attention list on that computer. Nobody is notified. `list_needs_attention` shows the list.
346
+ A run that stops for a person waits in Flow's Needs Attention list on that computer. `list_needs_attention` shows the list. Nobody is notified, unless the run is part of a [task-ledger job](#track-a-long-job): then the ledger asks a person on their phone or desktop.
337
347
 
338
348
  With `--mode attended`, your agent can send a decision with `continue_attention`, `skip_attention`, `reject_attention`, `teach_attention`, or `escalate_attention`. The person at the computer confirms each decision in a form. Continue and skip also need `--config`. If the client can't show forms, the server refuses the decision, and the person uses Flow's console instead:
339
349
 
@@ -374,28 +384,161 @@ If a workflow's name would come out as either one, emit-skill names the skill `o
374
384
 
375
385
  ### Record a first workflow
376
386
 
377
- `serve --authoring` adds recording tools, such as `observe`, `start_record`, `click`, `pause_for_input`, `stop_record`, `compile`, and `admit`. [docs/DESIGN.md](docs/DESIGN.md#recording-tools) lists all 14. Your agent uses them to help a person record a task in a web app. The recording server doesn't turn on runs.
387
+ `serve --authoring` adds recording tools, such as `observe`, `start_record`, `click`, `pause_for_input`, `stop_record`, `compile`, and `admit`. [docs/DESIGN.md](docs/DESIGN.md#recording-tools) lists all 14. A person or your agent shows the task with them, in a web app, a native Windows app, or an RDP or Citrix session, and a person stays at the computer to sign in and accept the result. A task can be learned from one or more demonstrations. The recording server doesn't turn on runs.
378
388
 
379
- 1. Add a recording server. `--url` opens the app in a new Chromium window with no saved sign-ins, and `--headed` keeps that window visible so the person can sign in.
389
+ 1. Register a recording server. The `tutorial` extra brings the browser driver that `--url` needs. `--url` opens the app in a new Chromium window with no saved sign-ins, and `--headed`, which `--url` requires, keeps that window visible so the person can sign in.
380
390
 
381
391
  ```bash
382
- claude mcp add openadapt-authoring -- uvx --python 3.12 --from 'openadapt-agent[tutorial] @ git+https://github.com/OpenAdaptAI/openadapt-agent' openadapt-agent serve --authoring --url https://app.example.com --headed
392
+ claude mcp add --scope user openadapt-authoring -- uvx --python 3.12 --from 'openadapt-agent[tutorial]' openadapt-agent serve --authoring --url https://app.example.com --headed
383
393
  ```
384
394
 
385
- 2. Ask your agent to record the task with the person. When the agent pauses for sign-in, the person signs in to the app in that window.
395
+ This only registers the server. Claude Code starts it the next time you run `claude`.
396
+
397
+ 2. Run `claude` and ask your agent to record the task with the person. When the agent pauses for sign-in, the person signs in to the app in that window.
386
398
  3. When the task is done, the agent calls `compile`. It writes the bundle to `<runs-dir>/authoring/bundle`, which is `~/.openadapt/runs/authoring/bundle` by default.
387
399
  4. The agent calls `admit`. Your MCP client then shows the person a confirmation form, and only the person's answer there accepts the bundle. If the client can't show forms (MCP form elicitation), `admit` refuses and nothing is accepted.
388
400
  5. Get the bundle ready to run (see [Get a workflow ready to run](#get-a-workflow-ready-to-run)). Then serve it with `--mode production --bundles <runs-dir>/authoring/bundle`.
389
401
 
390
- Use `--url URL --headed` on every platform. Without `--url`, the server exits on Linux, and on macOS it uses whatever window is in front when the client starts the server, or exits. For Windows desktop apps, Citrix, and RDP, the recording tools can only tell the person what to click. Record those apps with Flow's own recorder.
402
+ Use `--url URL --headed` for a web app on every platform. Without `--url`, the server exits on Linux, and on macOS it uses whatever window is in front when the client starts the server, or exits.
403
+
404
+ For a native Windows app, start Flow's Windows agent server in the signed-in desktop session on the Windows computer (`python -m openadapt_flow.backends.win_agent.server --port 5001`) and pass `--windows-agent-url http://localhost:5001`. The agent can run on that computer or on another one, such as a Mac. The server listens only on the Windows computer by default, so from another computer forward the port over SSH or serve it over HTTPS. Your agent's clicks and keys go through the same synthetic-input path that replay uses, and the recording keeps each clicked control's UI Automation id when Windows reports one. Set `OAFLOW_AGENT_TOKEN` to the same value for the server and the agent.
405
+
406
+ For an RDP or Citrix session, pass `--remote-window APP` (the client app, for example `"Microsoft Remote Desktop"`) or `--citrix`, and `--remote-window-title` when the app has more than one window. A remote session is screen-only: there's no DOM or UI Automation tree, so `observe` returns no nodes and your agent clicks x,y pixels in the client window and presses keys, the way a person would. To let your agent see that window, add `--authoring-screens scrubbed`, which turns on a `screen` tool that returns the frame with identifiers scrubbed and shares nothing if scrubbing fails. `--authoring-screens unscrubbed` skips scrubbing. Screens are off by default.
407
+
408
+ You can also name the app with a deployment file instead of these flags: `--authoring --config deploy.yaml --authoring-from-config`. The file's `backend:` section names a Windows app (`agent_url`), one macOS window (`macos_app`, optionally `macos_window_title`), one Linux window (`linux_app` and `linux_window_title`), or a local RDP or Citrix client window (`rdp_window`). It is the same section `openadapt-flow run --config` uses, so the recording and its runs drive the same app. This is how you record a Linux app, or a macOS app that isn't the frontmost window. Your agent clicks at window coordinates, so a Linux section also needs `linux_allow_physical_input: true`. Network RDP (`rdp_host`) is refused for authoring, because each run would open its own session and disconnect the recording's. Without `--authoring-from-config`, `--config` only configures runs.
409
+
410
+ [Recording on Windows, RDP and Citrix](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/docs/RECORDING_ON_WINDOWS_RDP_CITRIX.md) explains the Windows agent server, why it's needed when the agent runs on another computer, how to start it, the token, and the RDP and Citrix pixel path.
411
+
412
+ The recording marks every step as the agent's or the person's (`actor` in `events.jsonl`, `demonstrated_by` in `meta.json`), and a person still accepts the result. On Windows with none of these flags, the tools can only tell the person what to click.
413
+
414
+ ChatGPT and Claude in a web browser can't start a server on your computer. To record from one of them:
415
+
416
+ 1. On https://openadapt.ai/#job-box, type the job under **What job do you want to automate?** and click **Get a job page**.
417
+ 2. On the job page, click **Connect this computer**. Its **Open OpenAdapt** link is the runner link (`openadapt://runner?pack=...&bind=oab_...`). It opens OpenAdapt Desktop if you have it. The link works once and expires after five minutes if nobody claims it.
418
+ 3. Without Desktop, copy that link and run this on the computer that has the app:
419
+
420
+ ```bash
421
+ openadapt-agent authoring connect '<runner link>'
422
+ ```
423
+
424
+ It claims the job, polls openadapt.ai over outgoing HTTPS, and asks you in the terminal before a chat account may drive it. Don't confuse it with the launcher's `openadapt connect`, which pairs a computer with OpenAdapt Cloud. [docs/MAILBOX_CLI.md](docs/MAILBOX_CLI.md) has the details.
425
+
426
+ ### Guard an agent you already run
391
427
 
392
- ChatGPT and Claude in a web browser can't start a server on your computer. To record from one of them, start at https://openadapt.ai/start. When openadapt.ai gives you a runner link for the recording job (it contains `bind=oab_`), run this on the computer that has the app:
428
+ If your agent already drives a Chromium (a Playwright script, Playwright MCP, browser-use, or a computer-use agent with a browser), you don't have to move it onto these tools. Start its browser with a DevTools port, which is the one line you add, and run the guard next to it for each task:
393
429
 
394
430
  ```bash
395
- openadapt-agent authoring connect '<runner link>'
431
+ openadapt-flow guard --cdp http://127.0.0.1:9222 --config guard.yaml --task task.json --out runs/task-0001
396
432
  ```
397
433
 
398
- It claims the job, polls openadapt.ai over outgoing HTTPS, and asks you in the terminal before a chat account may drive it. Don't confuse it with the launcher's `openadapt connect`, which pairs a computer with OpenAdapt Cloud. [docs/MAILBOX_CLI.md](docs/MAILBOX_CLI.md) has the details.
434
+ The guard holds every save the agent's tab sends until the record on the screen is the one `task.json` names. When it isn't, the save is blocked and the agent's page says why. A save that goes through is read back from the system of record (`VERIFIED`, `REFUTED` or `RECONCILIATION_REQUIRED`). `--observe-only` never blocks and shows what the guard would have done.
435
+
436
+ When a run reads back correctly, it becomes a draft in the teach dir that `guard.yaml` names, with a record check built from the app's own reads. A person confirms the check and admits the draft (`openadapt-flow compile-agent admit`); then `serve --teach verify.yaml --teach-dir <that dir>` serves it as a `taught_<name>` tool that makes no model calls. [GUARD_AN_AGENT.md](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/docs/GUARD_AN_AGENT.md) has the files, what counts as a save, and the measurements.
437
+
438
+ ### Teach a new workflow from your agent
439
+
440
+ `serve --teach` lets your agent add a workflow it doesn't have yet, without leaving the conversation. It does the task once through OpenAdapt; OpenAdapt checks the record it saved, compiles the run, and once the run is admitted your agent calls it as a tool. Every later call runs the compiled program with no model calls and reads the save back.
441
+
442
+ ```bash
443
+ claude mcp add --scope user openadapt-teach -- uvx --python 3.12 --from 'openadapt-agent[tutorial]' openadapt-agent serve --teach verify.yaml --url https://emr-test.example.org --runs-dir ~/.openadapt/runs
444
+ ```
445
+
446
+ `verify.yaml` needs only a `verifier:` section that reads the app's records (`rest`, `sql`, `fhir`, `graphql` or `file`), the same file `openadapt-flow record --verify` uses. The first run makes a real entry in the app, so point `--url` at a test copy with test records.
447
+
448
+ Your agent then:
449
+
450
+ 1. Calls `teach_start` with the task (`{note}` for each input), this run's `inputs`, the `record_fields` the saved record must have (such as its patient id), and `on_screen`, the record's identity as the screen shows it (a name and an MRN).
451
+ 2. Calls `teach_run` with short scripts (read the page, act on elements by role and name, read the result back; web apps), or `teach_observe` and `teach_act` one action at a time, until the task is done. After every save the gate detects, OpenAdapt reads the app's records back and tells the agent what landed; a write on a record the task does not name ends the run after it lands. On the web, `teach_observe` lists the page as short lines with a ref for each control, and before every save OpenAdapt checks that the record's identity is shown next to the control. A save on the wrong record is refused and ends the run.
452
+ 3. Calls `teach_finish`. OpenAdapt compiles the run and reads the app's records: exactly one record must have appeared, with every `record_fields` value and every input. The result is the draft: its steps, its inputs, the proposed record check, and what still needs a person.
453
+ 4. Calls `teach_confirm_checks`. Your MCP client shows a person the proposed check, and only their answer there, with their name, confirms it. Your agent has no argument that confirms it.
454
+ 5. Calls `teach_admit` with `canary_inputs`, the values each canary saves. A canary is a real save on the same record, so use values that are safe there.
455
+
456
+ `teach_admit` admits only under the rules in [JIT_ADMISSION.md](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/docs/JIT_ADMISSION.md). The operator starts the server with `--teach-key agent.pem --teach-policy signed-policy.json`: the key of the agent registered with `openadapt-flow jit register --role agent`, and an admission policy a person signed with `openadapt-flow jit sign-policy`. The server records the run as that agent, so admitting it is self-admission, which the policy must allow (`allow_self_admission`). Without a key and a policy, `teach_admit` refuses and returns the command a person runs at a terminal instead:
457
+
458
+ ```bash
459
+ openadapt-flow compile-agent admit <task dir> --admit-as "<your name>" --canary-param note="Canary test note"
460
+ ```
461
+
462
+ Once the program is admitted, it is in `list_workflows` and `run_workflow` at once and has its own `taught_<name>` tool, and the server sends `notifications/tools/list_changed` to clients that support it. A server started later lists every program taught in its `--teach-dir`.
463
+
464
+ It works on a web app (`--url`) and on the app a deployment file's `backend:` section names (`--config deploy.yaml`): a native Windows, macOS or Linux window, or a local RDP or Citrix client window. Off the web, OpenAdapt can't read which record a form shows, so a person approves, in your client's form, every action that might save: any click except on a text field, a check box, a tab or a control that plainly navigates (Open, New, Cancel), any click at x,y, Enter, typing outside a text field, and shortcuts. Each answer covers that one action on the screen as it was; if anything changes first, the action isn't done. A client without forms can't save. RDP and Citrix have no control tree, and the Windows, macOS and Linux teach backends work from the screen, so off the web your agent needs `--teach-screens scrubbed` to see the screen, and clicks x,y pixels. Admission there fails closed: a pixel-only click carries no checked record identity, so the canary is refused and says why. Network RDP (`rdp_host`) is refused.
465
+
466
+ | Flag | What it does |
467
+ | --- | --- |
468
+ | `--teach VERIFY_YAML` | Adds `teach_start`, `teach_run` (web apps), `teach_observe`, `teach_act`, `teach_finish`, `teach_abort`, `teach_status`, `teach_confirm_checks` and `teach_admit`, and turns on runs of taught workflows. |
469
+ | `--teach-dir DIR` | Where drafts and taught programs live (default `RUNS_DIR/teach`). |
470
+ | `--teach-key PEM`, `--teach-policy JSON` | The registered agent's encrypted key (passphrase in `OPENADAPT_JIT_KEY_PASSPHRASE`) and the signed admission policy. Only an agent key under a policy; an admitter key admits from CI with `openadapt-flow jit admit`. |
471
+ | `--key-dir DIR` | The JIT key directory (default `OPENADAPT_JIT_KEY_DIR` or `~/.openadapt/jit`). |
472
+ | `--teach-hold` | On the web, a person also approves every save in the first run. Without it, your agent names the identity the save gate checks (`on_screen`); a value every form shows proves nothing, and then only the record check after the run and the person confirming it catch a wrong record. |
473
+ | `--teach-tasks DIR` | Run 1's record and inputs come from the operator's task files (`openadapt.guard-task/v1`); `teach_start` names one with `task_file`. Without it, your agent declares them at `teach_start`, before it reads the app. |
474
+ | `--teach-allow-origin URL` | Another origin run 1's browser may reach. Every origin but the app's is refused otherwise. |
475
+ | `--teach-write-adapter MODULE:ATTR` | The app's write adapter: each write in run 1 is read before it is sent, and one to another record, field or value is refused. |
476
+ | `--teach-screens scrubbed` | Adds `teach_screen`: the app's screen with identifiers scrubbed, and nothing shared if scrubbing fails. `unscrubbed` skips scrubbing. Off by default. |
477
+ | `--mode production --bundles DIR` | Serves your other workflows next to the taught ones. |
478
+
479
+ [COMPILE_AGENT.md](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/docs/COMPILE_AGENT.md) describes the pipeline underneath: the harness, the record check, the canaries and the files it keeps.
480
+
481
+ ## Track a long job
482
+
483
+ On long work, agents lose track of the rules they were given, miss information that arrives partway through, guess instead of asking, and skip checking their work ([OSWorld 2.0](https://arxiv.org/abs/2606.29537)). The task ledger keeps that state on the server, so your agent reads it instead of rebuilding it from its own history. It's on whenever runs or guarded saves are; `serve --no-ledger` turns it off.
484
+
485
+ | Tool | What it does |
486
+ | --- | --- |
487
+ | `open_job` | Opens a job with the user's intent, rules, and items. Rules are locked when the job opens. |
488
+ | `get_job` | Returns a short summary: current rules, counts by status, items not verified yet with their `request_id`, waiting questions, answers that came back, and what changed since the last read. |
489
+ | `add_items` | Adds up to 100 items per call, 500 per job. |
490
+ | `record_evidence` | Notes a fact and where it came from: `user` (trusted), or `app` or `document` (never trusted). |
491
+ | `ask_user` | Asks a person a yes-or-no question. Optional `wait_seconds`, 0 to 600. |
492
+ | `get_answer` | Returns `waiting`, `yes`, `no`, `expired`, or `refused`. Optional `wait_seconds`, 0 to 600. |
493
+ | `change_constraint` | Asks a person to change or add a rule. The old rule holds until they approve. |
494
+ | `close_job` | Closes the job. `complete` is true only when every item is verified and no question waits. `verified_items` lists what your agent may report as done. |
495
+
496
+ Each item has its own `request_id`, `<job_id>.<item_id>`. Pass it to `run_workflow`, and the server updates the item from its own result:
497
+
498
+ | Item status | Set when |
499
+ | --- | --- |
500
+ | `pending` | The item was added, a run didn't run, or a person asked for another try. |
501
+ | `running` | The run hasn't finished. |
502
+ | `verified` | The run ended `done`, a guarded save ended `VERIFIED`, or a person checked the record and said it saved. |
503
+ | `stopped_before_saving` | The run ended `needs_review`. |
504
+ | `check_the_record` | The run ended `not_sure_if_saved`, or a guarded save wasn't verified. |
505
+ | `saved_awaiting_check` | The save went through and waits for a later check, or a guarded save may write now. |
506
+ | `needs_person` | A question about the item waits, a save waits for approval, or a person said they'll handle it. |
507
+
508
+ ### What the server enforces
509
+
510
+ - Your agent can't set a status. Only this server's results and a person's answers do.
511
+ - A rule can name a `run_workflow` input and say it `equals` a value, is `one_of` some values, or is `not_one_of` them. The server refuses a run for the job that breaks a rule or leaves that input out, and the error ends "Nothing ran." A rule with only `text` is shown but not checked.
512
+ - Only a person changes a rule after the job opens. That holds when the change comes from the user, too; the person confirms it.
513
+ - The server refuses a run for an item while a question about it waits, and while it's `check_the_record` or `needs_person`. After a person asks for another try, the item gets a new `request_id`, `<job_id>.<item_id>.r2`, and the old one is refused.
514
+ - A run with any other `request_id` doesn't change an item. While a job is open, its summary counts those runs under `unplanned_writes`.
515
+ - Evidence never changes a rule or a status.
516
+
517
+ ### Questions reach a person
518
+
519
+ A question is a save-approval request, the same files Flow writes before a save. It shows on the paired phone and in Desktop's Run it, and a person answers there. Save means yes, Don't save means no, and the answer saves nothing in any app. The server checks each answer as a run checks a save approval: it must come from a person on Desktop or the phone, for that exact question, before it expired (4 hours). An answer from an agent or a script is refused.
520
+
521
+ When a run for an item stops before saving, the ledger asks whether to try again. When a save can't be confirmed, it asks the person to check the record. So a stop in a job reaches someone without anyone watching Needs Attention. Questions are written to `task-ledger` inside the runs folder. Point the console or Desktop at that runs folder.
522
+
523
+ ### Measured on a synthetic worklist
524
+
525
+ A scripted agent worked a 30-item synthetic MockMed worklist. The user changes a rule at item 13, item 20's referral tells the reader to mark everything urgent, two patients share a name, and two saves can't be confirmed (one didn't land). The agent has the same flaws in every arm: it acts on a rule only while the message that stated it is among its last 5 turns, it follows instructions it reads in a referral, it picks the first matching patient, and it reports every run that wrote something as done. A simulated person answers through the same list the phone reads. No model is called.
526
+
527
+ | | Agent alone | Ledger, enforcement only | Agent follows the ledger |
528
+ | --- | --- | --- | --- |
529
+ | Items saved against a rule | 12 | 0 | 0 |
530
+ | Items guessed instead of asked | 2 | 2 | 0 |
531
+ | Unverified items reported as done | 2 | 1 | 0 |
532
+ | Correct records (of 30) | 16 | 27 | 30 |
533
+ | Runs the ledger refused | 0 | 12 | 0 |
534
+
535
+ In the middle arm, the agent opens a job and uses each item's `request_id` but keeps its flaws. The ledger stops every rule break, but it can't stop an agent from guessing a value or misreporting its own tally. `close_job` still lists what was verified, so a caller can check the agent's report. The scripted agent stands for a policy, not a model, so these numbers test the mechanism. They aren't a model benchmark. To reproduce them (about 3 seconds):
536
+
537
+ ```bash
538
+ python packages/agent/tests/ledger_demo.py
539
+ ```
540
+
541
+ Results: [docs/task-ledger-measurement.json](docs/task-ledger-measurement.json).
399
542
 
400
543
  ## Security
401
544
 
@@ -432,15 +575,17 @@ openadapt-agent seal verify runs/<run_id>/report.json
432
575
  openadapt-agent seal verify https://example.com/receipt.json --json
433
576
  ```
434
577
 
435
- ## Limits
578
+ ## How runs work
436
579
 
437
- - Your agent, or a program acting for it, has to run on your customer's computer.
438
- - Nobody is notified when a run stops. Someone has to check `list_needs_attention` or Flow's console.
580
+ - Your agent, or a program acting for it, runs on your customer's computer.
581
+ - Runs that stop show up in `list_needs_attention` and Flow's console; inside a [task-ledger job](#track-a-long-job), a person gets the question on the phone or in Desktop.
582
+ - A job belongs to one server process. Give each server its own runs folder for a job.
583
+ - Ledger questions are yes or no. The phone card shows the question and says the answer saves nothing in any app.
439
584
  - The check that stops a second entry covers one runs folder. Pass the same absolute `--runs-dir` every time.
440
585
  - If the server exits during a run, the run reads as `not_sure_if_saved`, and Flow may still finish it.
441
- - This server issues no signed receipts itself. `proof` is `sealed` only when a run is connected to OpenAdapt Cloud Execute, Cloud signed its receipt, and that signature verifies against keys you pinned (see [Seals](#seals)).
442
- - With openadapt-flow 2, every save waits for a person's approval unless the operator names another mode (`serve --approval-mode problems_only` or `not_gated`). Your agent gets `needs_review` with the reason `waiting_for_approval`, and a person approves on the computer that runs OpenAdapt. Nothing is saved without that answer.
443
- - Each call carries one request. There's no batch call.
586
+ - `proof` is `sealed` when a run is connected to OpenAdapt Cloud Execute, Cloud signed its receipt, and that signature verifies against keys you pinned (see [Seals](#seals)).
587
+ - With openadapt-flow 2, each save waits for approval unless the operator names another mode (`serve --approval-mode problems_only` or `not_gated`). Your agent gets `needs_review` with the reason `waiting_for_approval`. A person answers on the computer that runs OpenAdapt, or your agent does when the server runs with `--delegate-approvals` and the run's approver policy allows an agent for that step. Nothing is saved without that answer. `get_approval_mode` tells your agent which mode applies; no tool changes it.
588
+ - Each call carries one request.
444
589
  - Accounts, separation between customers, fleet policy, and hosted runs belong to OpenAdapt Cloud.
445
590
 
446
591
  ## Release status
@@ -451,7 +596,7 @@ Under Flow's `standard` and `regulated` profiles, each workflow version also nee
451
596
 
452
597
  ## Package history
453
598
 
454
- Before version 2, this package ran AI agents that drove the screen. The name now refers to the agents that call it. A customer's workflows are supplied with `--bundles` and never ship in this package or its registry listing, and an install from a registry starts read-only. The MCP registry reads [server.json](server.json), Smithery packs from [manifest.json](manifest.json), and [llms.txt](llms.txt) describes the package for AI assistants. See [docs/DISTRIBUTION.md](docs/DISTRIBUTION.md).
599
+ Before version 2, this package ran AI agents that drove the screen. The name now refers to the agents that call it. A customer's workflows are supplied with `--bundles` and never ship in this package or its registry listing, and an install from a registry starts read-only. The MCP registry reads [server.json](server.json), Smithery packs from [manifest.json](manifest.json), and [llms.txt](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/llms.txt) describes the package for AI assistants. See [docs/DISTRIBUTION.md](docs/DISTRIBUTION.md).
455
600
 
456
601
  <!-- mcp-name: io.github.OpenAdaptAI/openadapt-agent -->
457
602