Skip to content

Rethinking the ActorTemplate and ActorTemplateVersion relationship, inspired by ActorSnapshotTag - #905

Closed
Zoe Zhao (zoez7) wants to merge 2 commits into
agent-substrate:mainfrom
zoez7:rethink-api
Closed

Zoe Zhao (zoez7) wants to merge 2 commits into
agent-substrate:mainfrom
zoez7:rethink-api

Conversation

@zoez7

@zoez7 Zoe Zhao (zoez7) commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator

Previously, the ActorTemplate object expressed both a group and a pointer.

  • It's a grouping mechanism of ActorTemplateVersion resources.
  • It has a pointer to one of the ATVs, i.e. default_version_on_create points to an ATV.

In this modified API, we separate out the "pointer" concept into ActorTemplateVersionTag, similar to ActorSnapshotTag.
After this, the ActorTemplate resource itself doesn't have any field anymore, therefore the ActorTemplate as a grouping concept that only needs a name and a ID.

Advantages are:

  • Users can have multiple named tags and is not restricted to one (default_version_on_create) only. Users can make their own decision of which Tag is considered "default".
  • Users can decide when to use a tag, and not restricted to a "tag" being available during CreateActor only.

below is an illustration of the relationships. This PR doesn't contain rollout policy tag, but we can add that in the future.

// +-- ActorTemplate ---------------------------------------+
// |                           +------------+               |
// |   +------------+          | RolloutTag |               |
// |   | DefaultTag |          +------------+               |
// |   +------------+        10% /          \ 90%           |
// |         |                  /            \              |
// |         v                 v              v             |
// |     +-------+         +-------+      +-------+         |
// |     | ATV-1 |         | ATV-2 |      | ATV-3 |         |
// |     +-------+         +-------+      +-------+         |
// +--------------------------------------------------------+

The API to create an Actor then becomes:

1. at := CreateActorTemplate(...)
2. atv := CreateActorTemplateVersion(at, spec)
4. tag := CreateActorTemplateTag(tag{"atespace", "my-default"}, atv) // replacement to UpdateActorTemplate.default_version_on_create
5. actor := CreateActor(tag)

Julian Gutierrez Oschmann (@juli4n) Let me know what you think.

I'm happy to see the amount of code I was able to delete in this PR :)

Comment thread pkg/proto/ateapipb/ateapi.proto Outdated
// CreateActor calls that do not pin a version. If unset, CreateActor
// without an explicit version fails with FailedPrecondition.
ObjectRef default_version_on_create = 3;
// Output only. Set at creation to the tagged version's actor_template_id;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need the actor_template_id here if you can extract it from actor_template_version? Is it to save one read?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is useful to support APIs like ListActorTemplateVersionTags(actor_template_id), so we don't have to first list all ATVs by actor_template_version

Comment thread pkg/proto/ateapipb/ateapi.proto Resolved
@mini-cookie

Copy link
Copy Markdown

Good mr!I want to add support for the E2B protocol. Building on the ActorTemplateVersion design, we should be able to implement the fork and checkpoint endpoints in ate-api-server fairly quickly~

@zoez7

Zoe Zhao (zoez7) commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

Comment thread pkg/proto/ateapipb/ateapi.proto Outdated
string in_progress_local_snapshot_name = 12;


ActorTemplateVersion actor_template_version = 13;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this mirror ActorSnapshotSource right below?
I am thinking of two things:

  • Our lifecycle histogram reads the template from the request on create but from the stored Actor on resume/suspend/pause/delete. So if you resolve the tag away, only create can label with it and the rest can't, which means I can't use it at all. If it's on the Actor it's actually a better label than the ATV name. Same reason OTel sets container.image.tags next to the digest.

  • We need an ATV uid too, for the same reason we have here for snapshot_uid, so names come back after a delete. We already pair ate.actor.uid with ate.actor.name for this in spans/logs.

Unrelated, just curious: field 13 was an ObjectRef on main and is now the whole message, so every Actor read carries a copy of the ATV's phase and golden_snapshot.
Is it intentional?

@zoez7
Zoe Zhao (zoez7) force-pushed the rethink-api branch 4 times, most recently from b0cfbf9 to a2f220a Compare August 14, 2026 19:10
@zoez7

Zoe Zhao (zoez7) commented Aug 18, 2026 •

Copy link
Copy Markdown
Collaborator Author

Closing this pull request, we agreed on:

  1. move the AT CRD to substrate as-is, immutable. No ATV resource on its own.
  2. ActorTemplateTag addresses a usability concern, is a P1 since users can work around the limitation by having a "pointer to a ActorTemplate" that they maintain outside of substrate.
  3. There will be no "ActorTemplateGroup" concept for now, until a concrete use case emerges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants