Skip to content

Commit af1cb66

Browse files
committed
feat(agents): introduce agent lifecycle domain and proto
Model the agent lifecycle as validated value objects and events so provisioning, revision staging, verdicts, activation, rollback, and archival share one authoritative contract across proto and the decider. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
1 parent a079507 commit af1cb66

165 files changed

Lines changed: 28083 additions & 10 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
edition = "2024";
2+
3+
package trogonai.agents.agents.state.v1;
4+
5+
import "trogonai/agents/agents/v1/revision_staged.proto";
6+
import "trogonai/agents/agents/v1/revision_verdict_recorded.proto";
7+
8+
message ActivateRevisionState {
9+
enum Lifecycle {
10+
LIFECYCLE_UNSPECIFIED = 0;
11+
LIFECYCLE_UNPROVISIONED = 1;
12+
LIFECYCLE_ACTIVE = 2;
13+
LIFECYCLE_ARCHIVED = 3;
14+
}
15+
16+
message StagedRevision {
17+
uint64 revision_number = 1;
18+
trogonai.agents.agents.v1.ChangeClass change_class = 2;
19+
// Unspecified until a verdict is recorded.
20+
trogonai.agents.agents.v1.Verdict verdict = 3;
21+
}
22+
23+
string agent_id = 1;
24+
Lifecycle lifecycle = 2;
25+
// Zero while unprovisioned; revision 1 is active immediately after provisioning.
26+
uint64 current_active_revision = 3;
27+
// Entries are unique and ordered by ascending revision number.
28+
repeated StagedRevision staged_revisions = 4;
29+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
edition = "2024";
2+
3+
package trogonai.agents.agents.state.v1;
4+
5+
message ArchiveAgentState {
6+
enum Lifecycle {
7+
LIFECYCLE_UNSPECIFIED = 0;
8+
LIFECYCLE_UNPROVISIONED = 1;
9+
LIFECYCLE_ACTIVE = 2;
10+
LIFECYCLE_ARCHIVED = 3;
11+
}
12+
13+
string agent_id = 1;
14+
Lifecycle lifecycle = 2;
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
edition = "2024";
2+
3+
package trogonai.agents.agents.state.v1;
4+
5+
import "trogonai/agents/agents/v1/agent_provisioned.proto";
6+
7+
message ProvisionAgentState {
8+
// Absence means the agent has not been provisioned.
9+
trogonai.agents.agents.v1.AgentProvisioned provisioned = 1;
10+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
edition = "2024";
2+
3+
package trogonai.agents.agents.state.v1;
4+
5+
import "trogonai/agents/agents/v1/revision_verdict_recorded.proto";
6+
7+
message RecordRevisionVerdictState {
8+
enum Lifecycle {
9+
LIFECYCLE_UNSPECIFIED = 0;
10+
LIFECYCLE_UNPROVISIONED = 1;
11+
LIFECYCLE_ACTIVE = 2;
12+
LIFECYCLE_ARCHIVED = 3;
13+
}
14+
15+
message StagedRevision {
16+
uint64 revision_number = 1;
17+
string author_principal = 2;
18+
// Unspecified until a verdict is recorded.
19+
trogonai.agents.agents.v1.Verdict verdict = 3;
20+
}
21+
22+
string agent_id = 1;
23+
Lifecycle lifecycle = 2;
24+
// Entries are unique and ordered by ascending revision number.
25+
repeated StagedRevision staged_revisions = 3;
26+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
edition = "2024";
2+
3+
package trogonai.agents.agents.state.v1;
4+
5+
message RollbackRevisionState {
6+
enum Lifecycle {
7+
LIFECYCLE_UNSPECIFIED = 0;
8+
LIFECYCLE_UNPROVISIONED = 1;
9+
LIFECYCLE_ACTIVE = 2;
10+
LIFECYCLE_ARCHIVED = 3;
11+
}
12+
13+
message ActivatedRevision {
14+
uint64 revision_number = 1;
15+
}
16+
17+
string agent_id = 1;
18+
Lifecycle lifecycle = 2;
19+
// Zero while unprovisioned; revision 1 is active immediately after provisioning.
20+
uint64 current_active_revision = 3;
21+
// Entries are unique, ordered by ascending revision number, and include revision 1.
22+
repeated ActivatedRevision previously_activated_revisions = 4;
23+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
edition = "2024";
2+
3+
package trogonai.agents.agents.state.v1;
4+
5+
message StageRevisionState {
6+
enum Lifecycle {
7+
LIFECYCLE_UNSPECIFIED = 0;
8+
LIFECYCLE_UNPROVISIONED = 1;
9+
LIFECYCLE_ACTIVE = 2;
10+
LIFECYCLE_ARCHIVED = 3;
11+
}
12+
13+
string agent_id = 1;
14+
Lifecycle lifecycle = 2;
15+
// Retained after archival so replay preserves the highest observed revision.
16+
uint64 highest_revision = 3;
17+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
edition = "2024";
2+
3+
package trogonai.agents.agents.v1;
4+
5+
// Wire command to move the active-revision pointer to an approved revision.
6+
message ActivateRevision {
7+
string agent_id = 1 [features.field_presence = LEGACY_REQUIRED];
8+
uint64 revision_number = 2 [features.field_presence = LEGACY_REQUIRED];
9+
// Opaque identity of the principal that dispatched activation. Principal
10+
// kind and charter authorization are checked before command dispatch.
11+
string activated_by = 3 [features.field_presence = LEGACY_REQUIRED];
12+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
edition = "2024";
2+
3+
package trogonai.agents.agents.v1;
4+
5+
// Charter is the minimal, versioned declaration of an agent (design Q16):
6+
// identity, engine, and dependency declarations. Nothing economic, temporal,
7+
// evaluative, or reputational lives here; those are stances on their own
8+
// planes (policy, evaluation, scheduling), selector-bound and human-owned.
9+
message Charter {
10+
// Execution engine. Immutable for the agent's v1 lifetime; switching
11+
// engines mints a new sibling agent rather than a revision (design Q24).
12+
string runtime = 1 [features.field_presence = LEGACY_REQUIRED];
13+
// Default model; a per-session override does not mint a revision.
14+
Model model = 2 [features.field_presence = LEGACY_REQUIRED];
15+
ToolDependencies tools = 3 [features.field_presence = LEGACY_REQUIRED];
16+
DelegateDependencies delegates = 4 [features.field_presence = LEGACY_REQUIRED];
17+
}
18+
19+
// ModelParameter is one deterministic model-configuration entry. Entries must
20+
// have unique keys and be ordered by key before they cross the wire boundary.
21+
message ModelParameter {
22+
string key = 1 [features.field_presence = LEGACY_REQUIRED];
23+
string value = 2 [features.field_presence = LEGACY_REQUIRED];
24+
}
25+
26+
// Label is selectable metadata. Entries must have unique keys and be ordered
27+
// by key so guest Wasm receives a deterministic sequence.
28+
message Label {
29+
string key = 1 [features.field_presence = LEGACY_REQUIRED];
30+
string value = 2 [features.field_presence = LEGACY_REQUIRED];
31+
}
32+
33+
// Annotation is opaque metadata. Entries must have unique keys and be ordered
34+
// by key so guest Wasm receives a deterministic sequence.
35+
message Annotation {
36+
string key = 1 [features.field_presence = LEGACY_REQUIRED];
37+
string value = 2 [features.field_presence = LEGACY_REQUIRED];
38+
}
39+
40+
// Model is a default, not a constraint; sessions may override it without
41+
// minting a revision.
42+
message Model {
43+
string id = 1 [features.field_presence = LEGACY_REQUIRED];
44+
repeated ModelParameter params = 2;
45+
}
46+
47+
// ToolDependencies are declarations, not grants. Grants are human-held,
48+
// evaluated live at every tool call on the Grants stream (design Q8/Q16).
49+
message ToolDependencies {
50+
repeated string required = 1;
51+
repeated string optional = 2;
52+
}
53+
54+
// DelegateDependencies are declarations, not permissions.
55+
message DelegateDependencies {
56+
repeated string required = 1;
57+
repeated string optional = 2;
58+
}
59+
60+
// RevisionRef pins a specific revision by number and content digest.
61+
message RevisionRef {
62+
uint64 number = 1 [features.field_presence = LEGACY_REQUIRED];
63+
string content_digest = 2 [features.field_presence = LEGACY_REQUIRED];
64+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
edition = "2024";
2+
3+
package trogonai.agents.agents.v1;
4+
5+
// AgentArchived is terminal-ish: no hard delete exists by design. Archived
6+
// agents reject further staging and activation.
7+
message AgentArchived {
8+
string agent_id = 1 [features.field_presence = LEGACY_REQUIRED];
9+
string reason = 2 [features.field_presence = LEGACY_REQUIRED];
10+
string principal = 3 [features.field_presence = LEGACY_REQUIRED];
11+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
edition = "2024";
2+
3+
package trogonai.agents.agents.v1;
4+
5+
import "trogonai/agents/agents/v1/agent.proto";
6+
7+
// AgentProvisioned is the Agent stream's genesis event; implicitly revision 1.
8+
// No limits, no rubrics, no grants live here (design Q15/Q16); those are
9+
// stances on their own planes.
10+
message AgentProvisioned {
11+
string agent_id = 1 [features.field_presence = LEGACY_REQUIRED];
12+
string name = 2 [features.field_presence = LEGACY_REQUIRED];
13+
// Placement node ref (bare spelling per the spelling rule: unsuffixed
14+
// `parent` means placement, kinship is always `parent<Type>Id`).
15+
string parent = 3 [features.field_presence = LEGACY_REQUIRED];
16+
// Opaque owner identity. The human-owner requirement is enforced before
17+
// command dispatch, where principal kind is known.
18+
string owner = 4 [features.field_presence = LEGACY_REQUIRED];
19+
// Selector-only keys (e.g. family); bounded, matchable syntax.
20+
repeated Label labels = 5;
21+
// Opaque decorative metadata; the platform never interprets these values.
22+
repeated Annotation annotations = 6;
23+
Charter charter = 7 [features.field_presence = LEGACY_REQUIRED];
24+
// Absent when provisioned outside a template.
25+
string template_id = 8;
26+
// Denormalized; the tenant is the tree root.
27+
string tenant_id = 9 [features.field_presence = LEGACY_REQUIRED];
28+
string principal = 10 [features.field_presence = LEGACY_REQUIRED];
29+
// Implicit revision 1: the provisioned definition, addressed by number
30+
// and content digest so downstream readers never need to special-case
31+
// the genesis revision.
32+
RevisionRef revision = 11 [features.field_presence = LEGACY_REQUIRED];
33+
}

0 commit comments

Comments
 (0)