Repository navigation
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.messageis sent unchanged as the first message of every run session, withMessageOrigin.kind: automation.AutomationTriggeredRunOrigin.eventholds "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.RunAutomationParamsis{ 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
-
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. -
Delivered as attachments. To deliver a run's message, the host uses
definition.messageunchanged (its text and the author's own attachments) and adds one input attachment per input, using a newMessageAttachmentKind. Each attachment identifies its source with the existingAutomationRunOriginshape and carries the content the agent receives for that input. -
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.
- Hosts MUST NOT interpolate trigger content into
-
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. -
Manual input.
runAutomationaccepts optionalinput: 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 editsdefinition.message. Manual input carries exactly the authority the invoker already has, as if they had typed it into a chat, and no more. -
Idempotency. Retrying
runAutomationwith the samerequestIdand the same parameters still returns the original run. A retry that reuses arequestIdwith differentinputMUST be rejected, rather than returning a run that never received that input. -
Capability. Clients may send
inputonly when the host advertisesautomations.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'slabel, 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.
MessageChatAttachmentalready 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
simpleorresourceattachment 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 theannotationsandchatkinds 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.
MessageAttachmentKindis@nonexhaustive,MessageAttachmentgains a variant, andRunAutomationParamsgains an optional, capability-gated field. AutomationRunOriginKind,AutomationRunStatus, and the other@exhaustiveenums don't change.- The chat channel is Stable. The new attachment variant can carry a
@stability 1.0annotation, 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
inputlater. - When and how a host combines several occurrences into one run.
Open questions
- Should input content be inline (
modelRepresentation), by reference (content), or either with a size threshold? - 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
sourcealready covers schedule occurrences. - Should manual text be an input attachment, or should it be delivered as the invoker's own words with an attribution marker?
- Which error should a mismatched
requestIdretry return:InvalidParamsorConflict?
Related proposals (none required)
- Concurrency and coalescing (Proposal: Automation concurrency limits, overlap policy, and coalesced runs #573) can produce runs that cover several trigger occurrences. Each occurrence gets its own input attachment.
- Continue an existing session (Proposal: Let automation runs continue an existing session #572) delivers the same message, with its input attachments, into an existing chat.
Activity
connor4312 commentedon Nov 9, 2026
My first take on this is that it would make more sense to make
MessageOrigina 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.
benvillalobos commentedon Nov 10, 2026
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?