Repository navigation
Open
Labels
area/apiUser-facing API changesarea/observabilitykind/featureAn enhancement / feature request or implementation
Description
That makes a few things hard:
- If you're running Substrate and an actor suspends, there's no way to see the reason unless you go dig through the caller's logs.
- The OTel GenAI agent lifecycle events (Add agent lifecycle events for async and long-running executions open-telemetry/semantic-conventions-genai#445) include a
pausedevent with apause.reason(human_inputorexternal_system). I built a prototype that emits thecheckpointedandresumedevents from ateapi, and that part works fine with what Substrate already stores. But I had to skippaused, because there's nothing to fill the reason with: https://github.com/raravena80/substrate/tree/genai-lifecycle-events/examples/genai-lifecycle
One thing to be clear on: in the OTel spec, the reason is what the agent is waiting for, not who triggered the suspend. human_input means "paused until a person responds", even if the agent is the one that called suspend. So there are really two separate things:
- Why (what the actor is waiting for): a person, an external system, nothing (just idle), etc.
- Who made the call: a user, a service account, a harness, or the actor itself.
Substrate can't figure out either one on its own. The caller knows, so it has to come in with the request. Some examples:
- Self-suspend (
PUT /v1/suspend): the actor is the caller, and the reason is oftenhuman_input. It needs someone to approve something, so it suspends itself until the reply comes in. SuspendActorfrom a harness: the harness is the caller, and the reason is usually an external wait, or the actor is idle.- Resume and delete: same idea. "Resumed because a person replied" and "resumed because a webhook fired" are different things to track.
A rough idea of what it could look like:
- An optional
reasonstring on the request options (SuspendOptionsand whatever the resume/delete equivalents are). Just free-form. Substrate doesn't need to know about OTel's values. - A separate field for who made the call (a user, a service account, or the actor itself), next to the reason.
- The control plane saves both on the actor record until the operation actually commits.
/v1/suspendreturns 202 before anything happens, so logging them when the request comes in isn't enough. - The state-change event includes them when the operation commits.
Things I'm not sure about:
- One shared attribution message for all the lifecycle calls, or a separate field on each options message?
- Free-form text, or a small set of Substrate values plus a free-form detail?
- Could Substrate fill in who from the request's auth, instead of trusting a field the caller sets?
- Should a resume point back to the suspend it's ending (e.g. the snapshot uuid), so it's easy to pair them up?
Reacted by L1nSn0w
Metadata
Metadata
Assignees
Labels
area/apiUser-facing API changesarea/observabilitykind/featureAn enhancement / feature request or implementation
Activity
lin-snow commentedon Nov 19, 2026
Ricardo Aravena (@raravena80)
I'd lean toward a shared attribution message with a small set of reason values rather than free-form strings.
human_input,external_system, andidlecover the main cases, withunspecified/otheras fallbacks. Protocol-specific context can go in an optional detail field. For automated clients,external_systemseems more appropriate thanhuman_input.For who, deriving the caller from the request's auth context is preferable to trusting a caller-supplied value.
principal.FromContextalready makes this possible in the handlers, though the self-suspend path may need separate consideration.One thing I noticed: once an actor is deleted, there's no actor record left to store the attribution. The delete event (or a separate audit record) would need to carry it. I'd also keep resume-to-suspend correlation separate from attribution, since they represent different concerns.
raravena80 commentedon Nov 19, 2026
Thanks, these all sound reasonable to me.
external_system: the reason describes what the actor is waiting for. A harness that suspends an agent waiting on someone's approval would still sendhuman_input. The caller type goes in the "who" field.RequestActorSuspendRequest.workerfrom the caller's certificate, and the actor has to be assigned to that worker. So Substrate can record the actor as the caller without trusting anything it sends.Scott Funkenhauser (@sfunkenhauser), does this direction work for you?
sfunkenhauser commentedon Nov 20, 2026
Da Huang (@git286) Do you have thoughts on this from the observability side?
git286 commentedon Nov 23, 2026
From the o11y side, adding a reason and a caller to
ate.actor.state_changedworks for me.My main question is the longer term one: how should
ate.actor.state_changedand the OTelgen_ai.agent.*events relate? The prototype has ateapi write both for the same change. If that becomes the plan, we get two records per transition, two schemas to keep in step, and a dependency on a convention that is still a draft. The wider design probably belongs in #1683.Krisztian F (@krisztianfekete) you designed these events. How do you see
ate.actor.state_changedand thegen_ai.*events fitting together, and are you fine with adding a reason and a caller to the existing event?raravena80 commentedon Nov 23, 2026
Yeah, agreed, I wouldn't want two records per transition upstream either. The prototype only writes both to show the #445 folks that a runtime can actually supply the IDs they're asking for.
I think it makes more sense to keep
ate.actor.state_changedas the only record, and anyone who wants thegen_ai.agent.*events can map them outside Substrate, like with a Collector transform. For that to work, the event would need one more thing besides the reason and caller: the snapshot UUID that the suspend wrote or the resume restored. With that, a suspend maps togen_ai.agent.checkpointed, a resume maps togen_ai.agent.resumed, and the actor UID works as the execution ID.Happy to move the bigger discussion over to #1683.
yongruilin commentedon Nov 24, 2026
From the https://github.com/google/ax side, we'd like a task to say how it ended when it self-suspends, e.g. "completed" or "waiting for approval".
Could
PUT /v1/suspendtake a short optional message?It would help if it stays on the Actor while suspended, like the crash message in
status.crash, since we read the Actor later instead of the event.krisztianfekete commentedon Nov 24, 2026
Thanks all, great discussion and feature request!
This is what I am thinking:
ate.actor.state_changedstays the only one record we set, and we never write anythinggen_ai.agent.*. Substrate is the runtime, not the agent, so it cannot knowexecution.idand other attrs., and if the framework inside the actor (ADK, LangGraph, etc.) is instrumented, we'd miscount events. Translating betweenate.*andgen_ai.*schemas happens downstream, e.g. in an OTel collector.We'd add to the event the following:
human_inputandexternal_systemasgen_ai.agent.pause.reasondoes, so mapping is a basically just copying. +idle,completedand_OTHERMessage: +1 Yongrui Lin (@yongruilin). Keep a short, bounded message on the
Actorstatus, likestatus.crash. I'd leave it off the event for now, since it's free text from the tenant.Regarding mapping: an idle or completed suspend maps to checkpointed only, never paused. And using the actor uid as
execution.idis a deployment choice (one actor per execution), so it belongs in the mapping config, not in Substrate.Happy to work on this once we settles all pending questions. What do you all think?
lin-snow commentedon Nov 24, 2026
Most of the discussion defines
reasonas what the actor is waiting for, which makes sense for suspend. Resume and delete seem different: on resume,human_inputwould have to mean "a person replied", rather than "waiting for a person", since the actor is no longer waiting. Delete has the same ambiguity (e.g. "deleted because a human approved it").Which semantics do you intend for resume and delete?
If the intent is the trigger, defining
reasonconsistently as "why this transition happened" would allow one enum to cover all three operations, with the "what the actor is waiting for" interpretation applying specifically to suspend. In the current proposal,gen_ai.agent.resumedhas no reason attribute, and it already links back withresumed_from.type/.id, which the snapshot UID can fill. That leavesreasonfree to describe the trigger.One related question: if
messagelives on the Actor status, when is it cleared? If resume clears it, the value is only visible while the actor is suspended, and google/ax reads the Actor later instead of the event.krisztianfekete commentedon Nov 24, 2026
Thanks L1nSn0w (@lin-snow), I'd say option 2 as
reasonis why transitions are happening, for every operation, like Kubernetes'Condition.reason, and the snapshot uid already links a resume to its suspend. For the message, I'd keep the last suspension's message on status until the next suspend replaces it (like a container'slastState), so Yongrui Lin (@yongruilin) can still read it after a resume.raravena80 commentedon Nov 24, 2026
This sounds great, thanks for pulling it all together! Going with option 2 for
reasonmakes sense to me. And yeah, doing the mapping downstream (including using the actor uid asexecution.id) is a lot cleaner than what my prototype does.I'd be happy to help out. One thing I could take on is the downstream part: an example Collector config that turns
ate.actor.state_changedinto thegen_ai.agent.*events, following your rules (idle and completed only becomecheckpointed, and the snapshot uid fills in the checkpoint and resume ids). I can rework my prototype into that once the event changes are in. But if you'd rather split things up differently, just let me know.