Skip to content

Proposal: Give automation runs their trigger context and manual input as data #569

Open

Description

Tracked in #568. This proposal stands on its own and doesn't depend on the others tracked there.

Summary

An event-triggered automation is only useful if its agent knows what happened: which pull request was opened, which comment was left, which issue to triage. AHP 1.0 sends every run the same definition.message, gives the agent no portable access to the event that caused the run, and gives a person no way to start a run on a specific item.

This proposal lets the host deliver each run's inputs (the trigger occurrence, or input from the person who started the run) as structured message attachments, kept separate from the author's instructions. Agents get the context they need, and "event content is data, not instructions" becomes a portable rule that clients can see in the transcript.

Scenarios

  • Review each new pull request. A trigger fires when a pull request is opened. The agent needs to know which pull request and what it contains, even though people outside the automation's control wrote its title, body, and comments.
  • Triage each new issue. Each run handles exactly the issue that triggered it.
  • Run on this item now. "Run triage on issue 42 now." "Re-run the release notes for v2.3 and focus on breaking changes." The person starting the run supplies the item and some direction.
  • Audit what the agent saw. After a bad outcome, a reviewer opens the run's session and sees exactly what event data the agent received, separate from what the author told it to do.

AHP today

  • AutomationDefinition.message is sent unchanged as the first message of every run session, with MessageOrigin.kind: automation.
  • AutomationTriggeredRunOrigin.event holds "host-defined, non-secret event provenance suitable for display or audit … descriptive context, not an input that clients replay." The spec doesn't say whether or how the agent receives the event.
  • RunAutomationParams is { automation, requestId }, so a manual run can't carry input.

As a result, every host invents its own prompt templating and splices event text into the message. Clients can't tell the author's instructions from event content in the transcript. The safety property that matters most for event-driven agents, treating text written by outsiders as data, depends on each host's private choices.

Proposal

  1. Run inputs. A run's inputs are what caused or parameterized it: the trigger occurrence that created it (the same information as today's origin), or manual input from the person who started it.

  2. Delivered as attachments. To deliver a run's message, the host uses definition.message unchanged (its text and the author's own attachments) and adds one input attachment per input, using a new MessageAttachmentKind. Each attachment identifies its source with the existing AutomationRunOrigin shape and carries the content the agent receives for that input.

  3. Rules for trigger content. These rules are the core of the proposal.

    • Hosts MUST NOT interpolate trigger content into Message.text. The text stays exactly what the author wrote.
    • Hosts MUST present trigger content to the agent as data, not as instructions. How a host frames data for its agent stays behind the host boundary. Clients SHOULD render input attachments as data, distinct from the instructions.
    • A person or account named in event content is provenance. It grants nothing and approves nothing.
    • Event provenance (source.event) keeps today's rule: no secrets, for display and audit only. Hosts MUST NOT put credentials such as tokens or webhook signatures in input content.

    These rules make the boundary between instructions and data explicit and portable. They don't make an agent immune to instructions embedded in data, and they don't prescribe how a host builds its prompt.

  4. Inputs are captured, not fetched later. The host captures an input's content when it accepts the input: when it admits the trigger occurrence, or when it accepts the manual run. Content that a client serves (for example, a virtual:// attachment in manual input) is read from the invoking client at that point, as the host already does when it captures automation customizations. Input attachments refer only to host-held, immutable content, so a run that waits in a queue doesn't depend on a client staying connected, and later changes to the external item don't change what the transcript says the agent received. Input attachments are part of the durable transcript, like any other attachment.

  5. Manual input. runAutomation accepts optional input: text and attachments from the person starting the run. The host delivers it as an input attachment whose source is { kind: 'manual' }, together with the invoker's attachments. It never replaces or edits definition.message. Manual input carries exactly the authority the invoker already has, as if they had typed it into a chat, and no more.

  6. Idempotency. Retrying runAutomation with the same requestId and the same parameters still returns the original run. A retry that reuses a requestId with different input MUST be rejected, rather than returning a run that never received that input.

  7. Capability. Clients may send input only when the host advertises automations.runInput, because an older host would silently ignore it. Input attachments on delivered messages need no capability. They are host-produced state, and a client that doesn't recognize the kind renders the attachment's label, as it would for any unknown attachment kind.

A run normally has exactly one input. If a host combines several trigger occurrences into one run, it adds one input attachment per occurrence. This proposal doesn't define when a host may combine occurrences.

Sketch

Names and shapes are illustrative. The implementation PR settles them.

/** New member of the @nonexhaustive MessageAttachmentKind. */
const enum MessageAttachmentKind {
  // ...existing members
  AutomationInput = 'automationInput',
}

/**
 * One input to an automation run, delivered with the run's message.
 * Trigger content is data for the agent, never instructions.
 */
interface MessageAutomationInputAttachment extends MessageAttachmentBase {
  type: MessageAttachmentKind.AutomationInput;
  /** What produced this input. Same shape as AutomationRunState.origin. */
  source: AutomationRunOrigin;
  /** The content the agent received, inline (like SimpleMessageAttachment)... */
  modelRepresentation?: string;
  /** ...or a reference to host-held, immutable content, fetched with resourceRead. */
  content?: ContentRef;
}

interface RunAutomationParams {
  // ...existing fields
  /** Input from the person starting the run. Requires automations.runInput. */
  input?: AutomationManualInput;
}

interface AutomationManualInput {
  text?: string;
  attachments?: MessageAttachment[];
}

interface AutomationCapabilities {
  // ...existing fields
  runInput?: {};
}

The message of a run triggered by a newly opened pull request:

{
  "text": "Review this pull request and leave one summary comment.",
  "origin": { "kind": "automation" },
  "attachments": [{
    "type": "automationInput",
    "label": "Pull request #123 opened",
    "source": {
      "kind": "trigger",
      "triggerId": "pr-opened",
      "event": { "repository": "octo/app", "pullRequest": 123, "action": "opened" }
    },
    "content": { "uri": "<host-served URI>", "contentType": "application/json" }
  }]
}

Why this shape

  • Attachments are how AHP delivers context with a message. Resource, annotation, and chat attachments already add context without changing the message text. MessageChatAttachment already has the host resolve and pin content when it accepts the message. A run input is the same idea.
  • A dedicated kind instead of a simple or resource attachment with a display hint. The protocol has to carry a security-relevant fact: this content came from outside the automation and is data. A distinct kind makes that unambiguous for every client and host, in the same way the annotations and chat kinds carry their own meaning.
  • Reuse AutomationRunOrigin. The run already describes its cause with this union. Reusing it avoids a parallel shape, and manual input fits as { kind: 'manual' }.
  • No templating language. How the prompt is built stays behind the host boundary. The protocol standardizes the separation, not the prompt.

Compatibility

  • Additive. MessageAttachmentKind is @nonexhaustive, MessageAttachment gains a variant, and RunAutomationParams gains an optional, capability-gated field.
  • AutomationRunOriginKind, AutomationRunStatus, and the other @exhaustive enums don't change.
  • The chat channel is Stable. The new attachment variant can carry a @stability 1.0 annotation, as other recent additions to stable channels do, while the automation channels mature.

Out of scope

  • Prompt templating languages and placeholder syntax.
  • Typed manual-run parameters, such as a declared input schema that a client renders as a form. This could build on input later.
  • When and how a host combines several occurrences into one run.

Open questions

  1. Should input content be inline (modelRepresentation), by reference (content), or either with a size threshold?
  2. Should schedule-triggered runs also get an input attachment (scheduled time, catch-up flag) so agents can reason about "since the last run"? The sketch allows it, because source already covers schedule occurrences.
  3. Should manual text be an input attachment, or should it be delivered as the invoker's own words with an attribution marker?
  4. Which error should a mismatched requestId retry return: InvalidParams or Conflict?

Related proposals (none required)

Activity

  1. added
    feature-request
    on Nov 6, 2026
  2. connor4312 commented on Nov 9, 2026

    @connor4312
    Member

    My first take on this is that it would make more sense to make MessageOrigin a union type and have automation-originated messages bear metadata there. Since it makes no sense to have an automation 'attachment' for a message that's not an automation run. Additionally, there is no sense to have selection ranges for automation 'attachments' and modelRepresentation is unnecessary since the attachment is created by and internal to the agent host.

    So a discriminated union could take an automation resource, though I'm unsure if we want to denormalize origin into that as well, since a client will need to subscribe to more automation state to e.g. interpret triggers anyway.

  3. benvillalobos commented on Nov 10, 2026

    @benvillalobos
    Member

    I generally agree that automations should have this context in the future we're headed towards. I don't have a strong preference on the shape, so long as it's flexible towards other trigger sources. (eg an automation triggering another automation)

    Also, I'm curious why all attachments would have an origin field. Wouldn't all attachments of a given run have the same origin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions