Skip to content

[Feature] Record why an actor was suspended, resumed or deleted #3972

Open

Description

That makes a few things hard:

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 often human_input. It needs someone to approve something, so it suspends itself until the reply comes in.
  • SuspendActor from 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 reason string on the request options (SuspendOptions and 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/suspend returns 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?

Activity

  1. lin-snow commented on Nov 19, 2026

    @lin-snow

    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, and idle cover the main cases, with unspecified / other as fallbacks. Protocol-specific context can go in an optional detail field. For automated clients, external_system seems more appropriate than human_input.

    For who, deriving the caller from the request's auth context is preferable to trusting a caller-supplied value. principal.FromContext already 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.

  2. added
    kind/feature
    area/api
    on Nov 19, 2026
  3. raravena80 commented on Nov 19, 2026

    @raravena80
    Author

    Thanks, these all sound reasonable to me.

    • A small enum plus an optional detail field works.
    • On external_system: the reason describes what the actor is waiting for. A harness that suspends an agent waiting on someone's approval would still send human_input. The caller type goes in the "who" field.
    • For self-suspend, atelet fills RequestActorSuspendRequest.worker from 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.
    • Agreed on delete and on leaving correlation out.

    Scott Funkenhauser (@sfunkenhauser), does this direction work for you?

  4. sfunkenhauser commented on Nov 20, 2026

    @sfunkenhauser
    Collaborator

    Da Huang (@git286) Do you have thoughts on this from the observability side?

  5. git286 commented on Nov 23, 2026

    @git286
    Collaborator

    From the o11y side, adding a reason and a caller to ate.actor.state_changed works for me.

    My main question is the longer term one: how should ate.actor.state_changed and the OTel gen_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_changed and the gen_ai.* events fitting together, and are you fine with adding a reason and a caller to the existing event?

  6. raravena80 commented on Nov 23, 2026

    @raravena80
    Author

    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_changed as the only record, and anyone who wants the gen_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 to gen_ai.agent.checkpointed, a resume maps to gen_ai.agent.resumed, and the actor UID works as the execution ID.

    Happy to move the bigger discussion over to #1683.

  7. yongruilin commented on Nov 24, 2026

    @yongruilin
    Contributor

    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/suspend take 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.

  8. krisztianfekete commented on Nov 24, 2026

    @krisztianfekete
    Collaborator

    Thanks all, great discussion and feature request!

    This is what I am thinking:

    ate.actor.state_changed stays the only one record we set, and we never write anything gen_ai.agent.*. Substrate is the runtime, not the agent, so it cannot know execution.id and other attrs., and if the framework inside the actor (ADK, LangGraph, etc.) is instrumented, we'd miscount events. Translating between ate.* and gen_ai.* schemas happens downstream, e.g. in an OTel collector.

    We'd add to the event the following:

    • reason: We can reuse human_input and external_system as gen_ai.agent.pause.reason does, so mapping is a basically just copying. + idle, completed and _OTHER
    • caller: do this from auth. It can be a client, the actor itself on self-suspend, or substrate itself.
    • snapshot uid: +1 Ricardo Aravena (@raravena80). It's what the GenAI checkpoint and resume ids map to, and it lets you pair a resume with its suspend without an extra field.

    Message: +1 Yongrui Lin (@yongruilin). Keep a short, bounded message on the Actor status, like status.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.id is 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?

  9. lin-snow commented on Nov 24, 2026

    @lin-snow

    Most of the discussion defines reason as what the actor is waiting for, which makes sense for suspend. Resume and delete seem different: on resume, human_input would 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?

    1. The prior wait condition, so the resume event carries the reason associated with the suspension it ends.
    2. The trigger for the transition, such as a human reply or a webhook.
    3. Separate fields or semantics for suspend, resume, and delete.

    If the intent is the trigger, defining reason consistently 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.resumed has no reason attribute, and it already links back with resumed_from.type / .id, which the snapshot UID can fill. That leaves reason free to describe the trigger.

    One related question: if message lives 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.

  10. krisztianfekete commented on Nov 24, 2026

    @krisztianfekete
    Collaborator

    Thanks L1nSn0w (@lin-snow), I'd say option 2 as reason is 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's lastState), so Yongrui Lin (@yongruilin) can still read it after a resume.

  11. raravena80 commented on Nov 24, 2026

    @raravena80
    Author

    This sounds great, thanks for pulling it all together! Going with option 2 for reason makes sense to me. And yeah, doing the mapping downstream (including using the actor uid as execution.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_changed into the gen_ai.agent.* events, following your rules (idle and completed only become checkpointed, 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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/apiarea/observabilitykind/feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions