Skip to content
This repository was archived by the owner on Oct 17, 2026. It is now read-only.

feat(mcp): read the approval mode; answer a waiting save as a delegated agent - #80

Closed
abrichr wants to merge 2 commits into
mainfrom
feat/delegated-approval-tools
Closed

abrichr wants to merge 2 commits into
mainfrom
feat/delegated-approval-tools

Conversation

@abrichr

@abrichr abrichr commented Oct 17, 2026

Copy link
Copy Markdown
Member

For Richard's review. Don't merge: openadapt-agent is frozen for the monorepo cutover.

What it adds

  • get_approval_mode (read-only, listed whenever runs are enabled). It returns the mode the operator chose (each_item, problems_only, not_gated, or flow_default), whether this agent may answer saves, and its id.
  • serve --delegate-approvals AGENT_ID is an operator opt-in. AGENT_ID is an opaque id. With it, two more tools appear:
    • list_approval_requests(run_id) returns allow-listed fields only: request id and digest, status, step id, index, class, mode and times. It never returns the step's words, the screenshot path or the run directory.
    • answer_approval_request(run_id, request_id, request_sha256, decision, decline_reason?) runs openadapt-flow item-approval approve|decline --decided-by automation --route mcp --delegate-kind agent --delegate-id AGENT_ID. Flow decides whether to accept it. By default its approver policy allows only a person, and a clinical write needs the customer's pinned opt-in. Flow records the agent as the approver, and the decision never becomes a training label. Flow's refusal comes back as-is, e.g. approver_kind_not_allowed.
  • Nothing changes the mode. An agent that could lower its own gate would make the gate pointless, so a per-run set was left out on purpose. No tool admits a check.

Depends on

Tests

  • tests/test_delegated_approval.py (9): answer tools are off by default; no set or admit tool exists; the exact Flow arguments; refusals are passed through; bad arguments never reach Flow; the request list drops everything outside the allow-list.
  • Full suite: 467 passed, 11 skipped. ruff check is clean.

…ed agent

get_approval_mode tells the calling agent which approval mode the operator
chose and whether it may answer saves. With serve --delegate-approvals
AGENT_ID, list_approval_requests (PHI-free fields only) and
answer_approval_request appear. An answer goes to openadapt-flow
item-approval as decided_by automation from the mcp route, naming the
agent; Flow accepts it only where the run's approver policy allows an
agent for that step, and records the agent as the approver. No tool
changes the mode or admits a check.

Needs the delegated-approver support in openadapt-flow
feat/approval-modes-delegated (not released).

Signed-off-by: Richard Abrich <richard.abrich@mldsai.com>
…pproves each one

With --delegate-approvals an agent can answer where the approver policy
allows it, so the help text, tool description and README no longer say a
person approves every save.

Signed-off-by: Richard Abrich <richard.abrich@mldsai.com>
@abrichr

abrichr commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

Carried over into the monorepo as OpenAdaptAI/OpenAdapt#1192 (merged as a7bd9fac5e008bdba3f01e6a7985c46f6819eab7). openadapt-agent now lives in OpenAdapt/packages/agent (code in packages/flow/openadapt_flow/agent).

@abrichr abrichr closed this Oct 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant