Add AgentGroup CRD and a controller to run a fleet of sandboxes#1
Draft
Sanchit2662 wants to merge 2 commits into
Draft
Add AgentGroup CRD and a controller to run a fleet of sandboxes#1Sanchit2662 wants to merge 2 commits into
Sanchit2662 wants to merge 2 commits into
Conversation
Adds an AgentGroup custom resource and a controller that brings up a fleet of agent sandboxes for one task, instead of a single sandbox per task. The controller creates one agent-sandbox Sandbox per agent, watches their Ready condition, and moves the group through Pending -> Initializing -> Running. This is a first slice toward multi-agentcube support (issue volcano-sh#301). Gang scheduling, the shared context store and the inter-agent message bus are intentionally left out of this change. Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>
Adds a Dependencies field of directed AgentDependency edges to AgentGroupSpec so the Hierarchical agent graph is part of the API contract from the start. The controller validates that every edge references a known agent and rejects self-edges; ordered startup by these edges is left as later work. Peer topology is accepted by the CRD enum but not implemented, so the controller now rejects it explicitly with an UnsupportedTopology failure instead of treating it as a silent no-op. Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now agentcube starts one sandbox per task. That single sandbox has to do everything at once, running the code and handling the agent runtime side. For bigger tasks that doesn't really hold up. Usually you want a few agents doing different jobs and working together on the same task.
So I started on the multi-agent side of things . This PR is the first piece of it.
what i added
A new CRD called
AgentGroup. You list a bunch of agents in it, and each agent just points at an existingCodeInterpreterorAgentRuntimefor its sandbox template. Then there's anAgentGroupControllerthat watches these and actually brings the fleet up.The controller itself is pretty simple. When you create an
AgentGroupit goes toPending, thenInitializingwhile it creates one Sandbox per agent, and thenRunningonce all of them report Ready. If the spec is wrong or a runtime reference doesn't exist it goes toFailedinstead. Every Sandbox it creates gets an owner reference back to theAgentGroup, so deleting the group cleans up all its sandboxes on its own and I didn't need a finalizer for that.I followed the same controller patterns the
CodeInterpreterReconcileralready uses, so it should feel consistent with the rest of the codebase. It usesGenerationChangedPredicateand only writes status when something actually changed, which avoids the controller waking itself up in a loop.what i left out on purpose
I kept this small so it's easy to review. It only does the cold path, meaning it creates plain
Sandboxobjects directly. No warm pool orSandboxClaimbatching yet. A few things I want to do in follow up PRs:how to try it
You should see it move
PendingtoInitializingtoRunning, andkubectl get sandboxes -l runtime.agentcube.io/agent-group=research-taskshows the sandboxes it created.tests
I added unit tests for the controller with the controller-runtime fake client. They cover the phase transitions, the all-ready and partially-ready cases, bad specs, a missing runtime reference, losing a sandbox while the group is Running, and checking the sandboxes come out owned by the group.
go build,go vetand the tests all pass, and the deepcopy plus CRD manifest are regenerated so codegen is in sync.Keeping this as a draft since it's the starting point and there's more coming.