Designing Human-AI Collaboration › The collaboration stack

Michael BrenndoerferDecember 2, 202620 min read
Language AI HandbookAll chapters
Part 62 of 67Human-AI Interaction and Governance
Chapter 472Designing Human-AI Collaboration › The collaboration stack
Reading section 3 of 10 · The collaboration stack · 20 minSection 3 of 10 · 20 min

Section 3 of 10 · 20 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Let's make the design concrete by describing a layered architecture. Each layer is an answer to a design question, and each can be implemented and tested separately.

The layering is not arbitrary. It reflects a particular order of decisions, from the most coarse-grained (how much should the model do?) down to the most fine-grained (how do we recover from a mistake?). Each layer constrains the ones below it: the autonomy levels you choose determine what handoffs are needed, the handoffs determine what context must travel, the context determines what feedback can take effect, and the feedback determines how recoverability should be structured. Building the stack top-down mirrors the way you would actually design a system: start with the division of labor, then work out the mechanics of moving work and state across the boundaries you have drawn. It also mirrors the way you would test a system, because each layer can be exercised in isolation with the deterministic fixtures we build along the way.

Layer 1: Autonomy level per subtask

Choose a level of automation separately for each subtask. Parasuraman, Sheridan, and Wickens distinguish the function being automated from the degree of automation. The six levels below are a local help-desk scale. A Model for Types and Levels of Human Interaction with Automation.

  1. Human does it. The model is silent.
  2. Model suggests, human decides and executes. The model proposes a single option; the human accepts or rejects.
  3. Model proposes a set, human selects. The model offers candidates; the human picks.
  4. Model recommends with rationale, human approves. The model makes a recommendation and shows reasoning; the human can override.
  5. Model acts, human is notified. The model executes; the human is told afterward.
  6. Model acts autonomously. The model executes silently.

In this scale the person executes at steps 2 through 4. At step 5, the system executes and then informs the person. That step warrants particular care because notice cannot prevent an effect that already happened. The numbered list starts at one, while the enum below stores the corresponding values from zero.

The routing label is visible and the staff can correct it. In this help desk, that makes classification a candidate for act-then-notify. The model proposes a remedy for approval. The configured SUGGEST level leaves execution to a person. The state machine below illustrates control transfer in general and does not implement the permissions of this refund policy.

In this help desk, the assignments are:

  • classify_intent: act-then-notify, because a mislabeled ticket is cheap to relabel.
  • lookup_order: act-then-notify, because the database is authoritative and the model only relays it.
  • draft_reply: recommend, because tone is flexible but policy compliance matters.
  • recommend_remedy: recommend, because the decision carries financial weight.
  • execute_refund: suggest, because execution is irreversible and consequential.

This per-subtask principle is the single most important idea in the chapter, so it is worth restating in a different key. Autonomy is not a property of "the assistant" as a whole; it is a property of each step the assistant takes. An assistant that is entirely autonomous is reckless, because it applies the same high autonomy to the irreversible refund as to the cheap relabel. An assistant that is entirely supervised is useless at scale, because it demands a human for every trivial classification and exhausts the scarce human attention that should be saved for real decisions. The useful assistant is selectively autonomous: aggressive where mistakes are cheap, cautious where mistakes are costly. Making that selectivity explicit, subtask by subtask, is the first layer of the design.

PythonIn [3]
CollapseExpand
from dataclasses import asdict, dataclass, field
from enum import IntEnum
from typing import Callable


class Autonomy(IntEnum):
    MANUAL = 0  # human does it
    SUGGEST = 1  # model suggests one option, human decides
    PROPOSE_SET = 2  # model proposes options, human selects
    RECOMMEND = 3  # model recommends with rationale, human approves
    ACT_THEN_NOTIFY = 4  # model acts, human is informed
    AUTONOMOUS = 5  # model acts silently


@dataclass
class Subtask:
    name: str
    autonomy: Autonomy
    reversible: bool
    consequential: bool

The Subtask record carries exactly the fields that drive the autonomy decision. The autonomy field is the assigned level. The reversible field captures whether a mistake can be undone locally or in the world. The consequential field captures whether a mistake has real cost, such as financial exposure or damage to a relationship. Keeping these as explicit data, rather than burying them in prose or intuition, means the design's reasoning is inspectable. You can read the table and see why each subtask got the level it did.

We now assign levels for the help desk. Notice how reversibility and consequence drive the choice.

PythonIn [4]
CollapseExpand
helpdesk_subtasks = [
    Subtask(
        "classify_intent",
        Autonomy.ACT_THEN_NOTIFY,
        reversible=True,
        consequential=False,
    ),
    Subtask(
        "lookup_order",
        Autonomy.ACT_THEN_NOTIFY,
        reversible=True,
        consequential=False,
    ),
    Subtask(
        "draft_reply", Autonomy.RECOMMEND, reversible=True, consequential=False
    ),
    Subtask(
        "recommend_remedy",
        Autonomy.RECOMMEND,
        reversible=True,
        consequential=True,
    ),
    Subtask(
        "execute_refund", Autonomy.SUGGEST, reversible=False, consequential=True
    ),
]

A table of names, levels, and flags is precise, but it hides the pattern the assignment is meant to teach. Plotting configured autonomy against each subtask, colored by reversibility, shows at a glance that the reversible subtasks sit high on the scale while the irreversible consequential ones sit low. We first encode the levels as numbers so the axis has meaning.

PythonIn [5]
CollapseExpand
autonomy_rows = [
    {
        "subtask": st.name.replace("_", " "),
        "level": int(st.autonomy),
        "reversible": st.reversible,
        "consequential": st.consequential,
    }
    for st in helpdesk_subtasks
]
VisualizationOut [6]
CollapseExpand
Dot plot of five subtasks by autonomy level, colored by reversibility.
Configured autonomy for each help-desk subtask, colored by reversibility. The irreversible refund is at suggest, while the reversible remedy recommendation still requires approval.
ConsoleOut [7]
CollapseExpand
classify_intent      autonomy=ACT_THEN_NOTIFY  reversible=True
lookup_order         autonomy=ACT_THEN_NOTIFY  reversible=True
draft_reply          autonomy=RECOMMEND        reversible=True
recommend_remedy     autonomy=RECOMMEND        reversible=True
execute_refund       autonomy=SUGGEST          reversible=False

Reversibility is one factor in choosing the level. A routing label that staff are likely to see and can correct is a candidate for more automation. Consequential actions also require evidence, a way to detect error, and a decision about who may act.

A remedy recommendation and refund execution are consequential for different reasons. The proposal can be revised before anything is issued. Carrying out a refund affects an external account. SUGGEST leaves that operation to the agent.

Layer 2: Mixed initiative

Autonomy level sets a default, but within a task the initiative moves. The human might start by typing a request, let the model retrieve and draft, then interrupt to redirect, then hand control back for the final send. Mixed initiative is the discipline of managing who leads at each step and making the handoffs clean.

The distinction between the default autonomy level and the actual flow of initiative is subtle but important. The autonomy level says "on this subtask, the model may go this far." Mixed initiative says "in this particular interaction, control passed from human to model here, back to human there, and forward to model again." A design that sets good autonomy levels but does not model initiative will still fail in practice, because the human cannot tell where they are in the task or what they are allowed to do next. Modeling initiative makes the flow of control explicit, so both the human and the system know the current phase and the available transitions.

We can model each turn as a state transition. The state includes who holds initiative and what the task phase is. Transitions are triggered either by the model (it needs input, it finished a phase) or by the human (interrupt, override, take over).

A named transition makes it possible to inspect which actor receives control and why. Check that every reachable nonterminal state has an appropriate exit. CLOSED is a valid terminal result with no outgoing transition. A cycle, such as redrafting after rejection, can keep a real task open until the person or service chooses another path.

PythonIn [8]
CollapseExpand
from enum import Enum


class Holder(Enum):
    HUMAN = "human"
    MODEL = "model"


class Phase(Enum):
    INTAKE = "intake"
    RETRIEVE = "retrieve"
    DRAFT = "draft"
    DECIDE = "decide"
    EXECUTE = "execute"
    CLOSED = "closed"


@dataclass
class TurnState:
    holder: Holder
    phase: Phase
    history: list = field(default_factory=list)


def advance(state: TurnState, event: str) -> TurnState:
    """Deterministic transition function for the help-desk loop."""
    transitions = {
        (Holder.HUMAN, Phase.INTAKE, "submit"): (Holder.MODEL, Phase.RETRIEVE),
        (Holder.MODEL, Phase.RETRIEVE, "retrieved"): (
            Holder.MODEL,
            Phase.DRAFT,
        ),
        (Holder.MODEL, Phase.DRAFT, "drafted"): (Holder.HUMAN, Phase.DECIDE),
        (Holder.HUMAN, Phase.DECIDE, "approve"): (Holder.MODEL, Phase.EXECUTE),
        (Holder.HUMAN, Phase.DECIDE, "reject"): (Holder.MODEL, Phase.DRAFT),
        (Holder.HUMAN, Phase.DECIDE, "takeover"): (Holder.HUMAN, Phase.EXECUTE),
        (Holder.MODEL, Phase.EXECUTE, "done"): (Holder.HUMAN, Phase.CLOSED),
        (Holder.HUMAN, Phase.EXECUTE, "done"): (Holder.HUMAN, Phase.CLOSED),
    }
    key = (state.holder, state.phase, event)
    if key not in transitions:
        raise ValueError(f"illegal transition: {key}")
    new_holder, new_phase = transitions[key]
    new_state = TurnState(new_holder, new_phase, state.history + [event])
    return new_state

Each tuple names a holder, a phase, and an event. The next state is deterministic for a listed triple. An unlisted triple raises an error. You can enumerate the permitted events at each reachable state and check their destinations.

Let's run a normal collaboration and a couple of deviation paths.

PythonIn [9]
CollapseExpand
def run_session(events):
    state = TurnState(Holder.HUMAN, Phase.INTAKE)
    for event in events:
        state = advance(state, event)
        print(
            f"{event:12s} -> holder={state.holder.value:6s} phase={state.phase.value}"
        )
    return state


print("== normal path ==")
run_session(["submit", "retrieved", "drafted", "approve", "done"])

print("\n== human rejects draft, model re-drafts ==")
run_session(
    ["submit", "retrieved", "drafted", "reject", "drafted", "approve", "done"]
)

print("\n== human takes over execution ==")
run_session(["submit", "retrieved", "drafted", "takeover", "done"])
ConsoleOut [10]
CollapseExpand
== normal path ==
submit       -> holder=model  phase=retrieve
retrieved    -> holder=model  phase=draft
drafted      -> holder=human  phase=decide
approve      -> holder=model  phase=execute
done         -> holder=human  phase=closed

== human rejects draft, model re-drafts ==
submit       -> holder=model  phase=retrieve
retrieved    -> holder=model  phase=draft
drafted      -> holder=human  phase=decide
reject       -> holder=model  phase=draft
drafted      -> holder=human  phase=decide
approve      -> holder=model  phase=execute
done         -> holder=human  phase=closed

== human takes over execution ==
submit       -> holder=model  phase=retrieve
retrieved    -> holder=model  phase=draft
drafted      -> holder=human  phase=decide
takeover     -> holder=human  phase=execute
done         -> holder=human  phase=closed
TurnState(holder=<Holder.HUMAN: 'human'>, phase=<Phase.CLOSED: 'closed'>, history=['submit', 'retrieved', 'drafted', 'takeover', 'done'])

Each transfer has a named event. On reject, initiative moves from the human in DECIDE to the model in DRAFT. On takeover, the holder stays human and the phase moves to EXECUTE.

The three traces illustrate the discipline in action. The normal path moves from human intake to model retrieval to model drafting to human decision to model execution and then closes. The reject path shows the human interrupting at the decision gate and sending the task back for a re-draft, which is the feedback loop in miniature. The takeover path shows the human choosing to execute themselves rather than hand execution to the model, which is exactly the control transition from Layer 1. In every case, the holder of initiative and the current phase are explicit at each step, so a human watching the interface would know exactly where the task stands.

PythonIn [11]
CollapseExpand
session_events = {
    "Approve draft": ("submit", "retrieved", "drafted", "approve", "done"),
    "Request a revision": (
        "submit",
        "retrieved",
        "drafted",
        "reject",
        "drafted",
        "approve",
        "done",
    ),
    "Take over": ("submit", "retrieved", "drafted", "takeover", "done"),
}
initiative_traces = {}
for name, events in session_events.items():
    state = TurnState(Holder.HUMAN, Phase.INTAKE)
    trace = [state.holder]
    for event in events:
        state = advance(state, event)
        trace.append(state.holder)
    initiative_traces[name] = trace
VisualizationOut [12]
CollapseExpand
Three step sequences show when the human or the model leads.
The color identifies who leads after each event in the fictional help-desk workflow. A revision adds a return to the model, while takeover leaves the human in charge through execution and closure.
Initiative vs. authority

Initiative is who drives the current step. Authority is who is entitled to make a decision or carry out an action. In the help desk, the model holds initiative during RETRIEVE and DRAFT. The human must still approve consequential decisions. The generic transition table illustrates that transfer, and the refund example later gives the consequential action to the person.

Layer 3: Shared context

The model-to-human handoff in DECIDE transfers the proposed remedy. If the interface sends only the draft, it leaves the relevant order record and the basis for the recommendation out of the approval view.

A reviewer can often recover missing information through another tool, but that puts verification outside the normal decision path. In the fictional desk, compare what the draft-only and case-file layouts put in front of the person.

Shared context means both parties can see the same task representation. In practice this is the difference between handing over a draft and handing over a case file. Let's implement a case file that travels with the handoff.

The phrase "case file" is borrowed deliberately from high-stakes professional work. A surgeon handing off a patient at shift change does not say "the patient is fine"; they hand over a structured record of vitals, medications, concerns, and pending decisions. A lawyer handing off a case does not hand over a one-line summary; they hand over the file. The reason is the same in each case: the receiver must be able to independently verify the conclusion and continue the work without reconstructing everything from scratch. The case file we build here is the minimal version of that idea for the help desk. It records the customer, the detected intent, the order, the evidence gathered, the draft, the proposed action, the rationale, and any defects. That is enough for a human to see why the model is proposing what it proposes, and to disagree on the basis of the same evidence the model used.

PythonIn [13]
CollapseExpand
from dataclasses import dataclass, field


@dataclass
class Evidence:
    source: str
    text: str
    status: str


@dataclass
class CaseFile:
    """The shared task representation carried across handoffs."""

    customer_id: str
    intent: str | None
    order_id: str | None
    evidence: list = field(default_factory=list)
    draft: str | None = None
    proposed_action: str | None = None
    rationale: str | None = None
    defects: list = field(default_factory=list)

    def coverage(self) -> float:
        """Fraction of slots the human needs that are populated."""
        required = [
            "intent",
            "order_id",
            "draft",
            "proposed_action",
            "rationale",
        ]
        present = sum(1 for r in required if getattr(self, r) is not None)
        return present / len(required)

Evidence carries the fixture source name, product name, and recorded order status. The source name alone gives one level of provenance. A production system should also carry a stable record identifier and the version or retrieval time where it matters. Coverage counts populated slots and does not verify that evidence supports the proposal.

Now a deterministic builder that fills the case file from a small, fixed "backend." No network, no randomness. Every value is computed from the fixtures.

PythonIn [14]
CollapseExpand
ORDERS = {
    "C001": {
        "order_id": "O-4471",
        "product": "Ceramic Mug Set",
        "status": "delivered",
    },
    "C002": {
        "order_id": "O-9920",
        "product": "USB-C Cable",
        "status": "in_transit",
    },
}

INTENT_KEYWORDS = {
    "damage": ["cracked", "broken", "damaged", "chipped"],
    "delay": ["late", "hasn't arrived", "where is", "still waiting"],
}


def classify(text: str) -> str:
    low = text.lower()
    for intent, kws in INTENT_KEYWORDS.items():
        if any(kw in low for kw in kws):
            return intent
    return "other"


def build_case_file(customer_id: str, message: str) -> CaseFile:
    intent = classify(message)
    order = ORDERS.get(customer_id)
    cf = CaseFile(
        customer_id=customer_id,
        intent=intent,
        order_id=order["order_id"] if order else None,
    )
    if order:
        cf.evidence.append(
            Evidence("orders_db", order["product"], order["status"])
        )
    if intent == "damage":
        cf.proposed_action = "replacement_or_refund"
        cf.rationale = "damage keyword detected on a delivered item"
        cf.draft = (
            "I'm sorry your mug arrived cracked. "
            "I can send a replacement right away or process a refund."
        )
    elif intent == "delay":
        cf.proposed_action = "track_or_reship"
        cf.rationale = "delay keyword detected on an in-transit order"
        cf.draft = (
            "Your cable is still in transit. Would you like tracking details?"
        )
    else:
        cf.proposed_action = "escalate"
        cf.rationale = "intent unrecognized, needs a human"
        cf.draft = "Let me connect you with a specialist."
    return cf

The builder treats the keyword category as an initial hypothesis. Order facts are populated from the fixture. In the damage branch it still offers a remedy even if delivery is contradicted or not known. We keep that flaw visible so the three designs can handle the same wrong suggestion later.

PythonIn [15]
CollapseExpand
cf = build_case_file("C001", "My mug arrived cracked, what can you do?")
print(f"intent={cf.intent} order={cf.order_id} action={cf.proposed_action}")
print(f"coverage={cf.coverage():.2f}")
print(f"draft: {cf.draft}")
ConsoleOut [16]
CollapseExpand
intent=damage order=O-4471 action=replacement_or_refund
coverage=1.00
draft: I'm sorry your mug arrived cracked. I can send a replacement right away or process a refund.

Coverage is 1.00 because all five counted fields are populated. The score does not test evidence accuracy, freshness, or whether the evidence supports the recommended remedy. A handoff containing only the draft has coverage 0.20 on the same five-field denominator.

The check is useful for finding an absent slot, not for deciding whether the submitted evidence is reliable. In particular, the in-transit record will populate all five slots and still conflict with the damage draft. Give it an explicit policy check.

A fluent handoff is not a complete one

Show missing fields alongside the draft. For a consequential action, require specific evidence before approval. A populated field can still be wrong.

Layer 4: Feedback

Feedback is how the loop learns. There are several kinds, and conflating them is a common design error:

  • Correction updates the current case. Revalidate context derived from the corrected field before asking for approval again.
  • Preference records a session-level choice such as tone. A later draft step has to read it for the preference to take effect.
  • Policy update records a rule in its own scope. In production, authorize and version such changes through the policy process.

Correction and preference can be handled inline. Policy update needs to reach the configuration that sets autonomy levels. A design that treats all feedback as "the same kind of thing" will either over-fit a one-off correction into a permanent rule or under-fit a real policy change into a one-time nudge.

The identity correction is local to the ticket. A preference can remain local to a session, or a separate workflow can let a user save it across sessions. A policy change needs the authority to apply to other cases. Store those decisions separately.

Let's implement a small feedback handler that distinguishes the three kinds.

PythonIn [17]
CollapseExpand
from enum import Enum


class FeedbackKind(Enum):
    CORRECTION = "correction"
    PREFERENCE = "preference"
    POLICY = "policy"


@dataclass
class Feedback:
    kind: FeedbackKind
    payload: dict


def apply_feedback(
    cf: CaseFile, fb: Feedback, session_prefs: dict, policy: dict
) -> CaseFile:
    if fb.kind is FeedbackKind.CORRECTION:
        cf.order_id = fb.payload["order_id"]
        cf.evidence.clear()
        cf.proposed_action = None
        cf.rationale = None
        cf.draft = None
        cf.defects.append("verify corrected order")
    elif fb.kind is FeedbackKind.PREFERENCE:
        session_prefs.update(fb.payload)
    elif fb.kind is FeedbackKind.POLICY:
        policy.update(fb.payload)
    return cf

The three scopes have separate stores. In this fixture, the supported correction changes the order identifier. It drops the old evidence, rationale, and draft and asks for the order to be verified again. The session and rule branches record their values. They do not train a model or enforce a new policy.

Let's watch each kind affect a different scope.

PythonIn [18]
CollapseExpand
session_prefs = {}
policy = {"damage_refund_max_usd": 100}

cf = build_case_file("C001", "My mug arrived cracked")
print(f"before: order_id={cf.order_id}, prefs={session_prefs}, policy={policy}")

apply_feedback(
    cf,
    Feedback(FeedbackKind.CORRECTION, {"order_id": "O-9999"}),
    session_prefs,
    policy,
)
apply_feedback(
    cf,
    Feedback(FeedbackKind.PREFERENCE, {"tone": "formal"}),
    session_prefs,
    policy,
)
apply_feedback(
    cf,
    Feedback(FeedbackKind.POLICY, {"damage_refund_max_usd": 50}),
    session_prefs,
    policy,
)

print(f"after:  order_id={cf.order_id}, prefs={session_prefs}, policy={policy}")
ConsoleOut [19]
CollapseExpand
before: order_id=O-4471, prefs={}, policy={'damage_refund_max_usd': 100}
after:  order_id=O-9999, prefs={'tone': 'formal'}, policy={'damage_refund_max_usd': 50}

The order correction acts on the case and invalidates the previous proposal. The tone preference acts on session state. The policy branch stores a new refund cap in the separate dictionary. A production gate would read a versioned policy record when making the approval decision.

It is worth tracing what would go wrong under the opposite design, where all feedback is applied to a single store. If a human corrects an order number by saying "no, it's O-9999," and that correction is written into the global policy, then every future ticket that mentions a damaged mug will now have its order replaced with O-9999. The fix meant for one case has poisoned all of them. Conversely, if a human changes the refund policy by saying "damage claims over $100 need manager approval," and that change is only applied to the current session, then the very next session will resume granting $100+ refunds without approval, silently undoing a safety decision. Keeping the three scopes separate is not a matter of tidiness; it is what prevents the two failure modes just described.

Layer 5: Reversibility and checkpoints

Reversibility affects which mistakes an agent can recover from. A local checkpoint and an external compensating action address different kinds of effects.

  • Checkpointing makes a snapshot of local task state before a consequential step. That gives the human a state to restore if the local step needs to be retried.
  • Compensating actions apply a subsequent action to mitigate a persistent effect, such as sending a correction after an inaccurate email.

Checkpointing stores local state. A compensating action can help with an effect already sent beyond that state, such as a mistaken notification. It may require its own permission and cannot remove a message the recipient already read.

Let's implement a checkpoint over local case-file state. The example records a simulated action in memory.

PythonIn [20]
CollapseExpand
import copy


class CheckpointedTask:
    def __init__(self, cf: CaseFile):
        self.cf = cf
        self._checkpoints = {}
        self._executed = []

    def checkpoint(self, name: str):
        self._checkpoints[name] = copy.deepcopy((self.cf, self._executed))

    def execute(self, action: str):
        self.cf.proposed_action = action
        self._executed.append(action)

    def revert(self, name: str):
        if name not in self._checkpoints:
            raise ValueError(f"no checkpoint '{name}'")
        self.cf, self._executed = copy.deepcopy(self._checkpoints[name])

CheckpointedTask stores deep copies of the case file and its action list under each checkpoint name. A shallow copy could still share nested evidence objects. Reverting restores a fresh copy so later edits to the live record do not change the checkpoint.

PythonIn [21]
CollapseExpand
task = CheckpointedTask(build_case_file("C001", "My mug arrived cracked"))
task.checkpoint("pre_execute")
task.execute("issue_refund_42usd")
print(f"after execute: action={task.cf.proposed_action}, log={task._executed}")

task.revert("pre_execute")
print(f"after revert:  action={task.cf.proposed_action}, log={task._executed}")
ConsoleOut [22]
CollapseExpand
after execute: action=issue_refund_42usd, log=['issue_refund_42usd']
after revert:  action=replacement_or_refund, log=[]

Note that reverting the local state is not the same as reverting the world. If the refund was actually processed, restoring the case file does nothing to the customer's account. This is precisely why the layer exists: it forces you to think about whether an action is locally reversible, world-reversible, or only compensable. Locally reversible actions can be checkpointed. World-irreversible actions need either a hard approval gate before execution, or a compensating action after. The checkpoint is necessary but not sufficient.

Distinguish local restoration, reversal of a completed external effect when the service supports it, and partial compensation. The example implements local restoration. If external rollback is unavailable, design a gate before the action and decide in advance what remedies remain possible.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy