Agents: Plan Mode should allow research — label actions as queries or mutators, and make plan-mode access configurable per agent

Aperta
#6,663 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
12/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
ai, backend

Direzione di ricerca

This is a design proposal with three unresolved open questions, so the first step is a decision, not an edit. Read the plan-mode gate in base-agent.ts around line 7550 (validateNextStep) and buildPlanApprovalForm, then trace how the composite steps ForEach, While, Pipeline and Tasks dispatch actions and sub-agents so the same check can cover them. Sketch the metadata changes (MJ: Actions, MJ: AI Agent Actions, MJ: AI Agents.PlanModeAccess, PlanModeWritablePaths) and get maintainer agreement on where the query/mutator label lives before any implementation. Done means an agreed design, then the gate exemption plus tests covering query, mutator and composite-step cases.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Summary

Plan Mode should stop an agent from changing things before approval, not from researching. Today it blocks every Action and every Sub-Agent call until the plan is approved, so an agent can't look anything up while it plans. Meanwhile ForEach, While, Pipeline and Tasks, which can run actions and sub-agents, are not gated at all.

This proposes:

  • labeling actions as queries (read-only) or mutators (change state),
  • letting Plan Mode run queries by default,
  • letting each agent configure exactly which actions and sub-agents it may use while planning.

Current behavior (on next)

  • The gate: in BaseAgent.validateNextStep (base-agent.ts ~7550), if (this._planModeActive && !this._planApproved && (step === 'Actions' || step === 'Sub-Agent')) demotes the step to Retry.
    • There is no exemption for read-only actions. A planning agent can't call "Get Entity Details", run a read-only query, or delegate to a research sub-agent.
  • Composite steps aren't gated: ForEach, While, Pipeline and Tasks are not checked, though each can run actions or sub-agents. The gate is too strict for direct calls and too loose for composite steps.
  • Fixed approval form: buildPlanApprovalForm always builds a markdown textarea plus approve/reject buttons. A plan that needs a richer preview (a mockup, a diagram) can't show one.

Agentic coding tools draw the line in a different place. Plan mode there allows reading, searching, read-only commands and research sub-agents, and blocks edits and state-changing commands until the plan is approved.

Proposal

1. Label actions as queries or mutators

Add a classification with two values:

Value Meaning Examples
Query Reads only; no state changes anywhere Get Entity Details, Run View, Run Query, web search
Mutator Changes MJ data or anything outside it Create/Update/Delete Record, Send Email, webhooks

Unclassified actions count as Mutator, so nothing becomes callable in Plan Mode by accident.

Where the label lives (open question):

  • On MJ: Actions (recommended). Whether an action changes state is a fact about its code, and it's the same no matter who calls it.
    • MJ: Actions already records facts like this (IsIdempotent, CompensationActionID).
    • It's labeled once instead of on every agent that uses the action.
    • MCP, A2A, GraphQL, scheduled jobs and the governance work in #4614 can all use it, not just agents.
  • On MJ: AI Agent Actions. Plan Mode is only relevant when an agent calls the action, and actions are a lower-level construct that shouldn't carry agent concepts.
    • Costs: the same fact is repeated on every agent-action row; it can't be reused outside agents; and an action that changes state could be labeled Query on one agent by mistake.

Recommendation: both, at two levels.

  • The fact (Query/Mutator) goes on MJ: Actions.
  • The policy, whether this agent may call the action while planning, goes on MJ: AI Agent Actions as an override (§2).

That keeps what an action does separate from what an agent is allowed to do with it.

2. Per-agent policy
  • MJ: AI Agents.PlanModeAccess sets the default for what the agent can call while planning:
    • Queries (new default): query actions only.
    • None: today's behavior, blocking all actions and sub-agents.
  • MJ: AI Agent Actions.AllowedInPlanMode is nullable; null follows the agent default. It can allow a specific mutator, such as writing a scratch record, or block a specific query.
  • Sub-agents: the same nullable AllowedInPlanMode on child agents and on MJ: AI Agent Relationships, defaulting to blocked. A research sub-agent can be allowed while a builder sub-agent stays blocked.
3. Rules that keep it consistent
  • Plan Mode carries into sub-agents. An allowed sub-agent runs under the same restrictions, using its own policy. It can research but can't change anything.
  • Composite steps are checked. ForEach, While, Pipeline and Tasks are allowed only if every action and sub-agent inside them is allowed.
  • Payload writes while planning. Add PlanModeWritablePaths on the agent: the payload paths the agent may write during planning (e.g. a draft spec). Other payload paths stay locked until approval. Planning usually produces something, and today there is no defined rule for what it may write.
4. Related: configurable approval form

Let an agent supply the plan-approval form, as a response form or template on the agent, instead of always using buildPlanApprovalForm. This allows a rich preview (rendered mockup, diagram) next to approve, reject and feedback.

Why

Skip's requirements stage researches the client's schema (entity details, tag summaries) before it writes requirements and a mockup for the user to approve. Plan Mode is the natural fit for that "research, propose, approve, build" flow, but today it blocks the research. More generally, agents produce better plans when they can look things up first.

Open questions

  1. Where the label lives (§1). We recommend both levels, but storing it only on MJ: AI Agent Actions is a real alternative.
  2. Is a third value worth it: Query / Internal (writes MJ data) / External (sends email, calls third parties)? A third value would let approval unlock internal writes while external effects still need confirmation each time. Two values are enough to start.
  3. Should runtime-added actions (skills, actionChanges) inherit the label from MJ: Actions? Yes would be the natural answer, but it's worth confirming.

Relationship to #4614

The query/mutator label is a natural input to the governance work in #4614. A deny/approval rule like "mutators need approval in shared conversations" becomes a simple policy once actions carry the label.

🤖 Generated with Claude Code

Lingua principale
TSQL
Stelle
32
Fork
7
Merge medio
1g 16h
PR unite (30g)
504

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MemberJunction/MJ

Tutte le issue di MemberJunction/MJ

Issue simili

Altre issue su AI Infra & Agents

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.