support running declarative agents in substrate#1981
Merged
Conversation
|
Warning Testing pausedMonthly snapshot limit reached. Update your plan for additional snapshots and to resume testing. |
Contributor
There was a problem hiding this comment.
Pull request overview
Enables running declarative (Go) sandbox agents on Agent Substrate by adding a spec.sandbox.platform=substrate control-plane selector, updating the UI to handle substrate’s multi-session model, and extending the controller/A2A proxy to provision and route per-session substrate actors (with digest-pinned runtime images for ActorTemplates).
Changes:
- Add
spec.sandbox.platform+ substrate-specific sandbox settings (WorkerPoolRef, snapshots) and enforce substrate constraints (no skills; Go runtime). - Update UI sandbox agent creation + chat/session UX to support substrate multi-session (and improve session title/timestamp handling).
- Embed runtime image digests into the controller at link time and update translator outputs/tests to use
@sha256pinned images.
Reviewed changes
Copilot reviewed 114 out of 115 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ui/src/types/index.ts | Add sandbox platform + substrate sandbox config types. |
| ui/src/lib/sessionTitle.ts | Centralize session title derivation + placeholder detection. |
| ui/src/lib/sessionTimestamps.ts | Normalize/validate session timestamps for UI display. |
| ui/src/lib/sandboxAgentForm.ts | Map sandbox spec ↔ form fields; sandbox chat-mode helpers. |
| ui/src/lib/agentSkillsForm.ts | Add substrate-sandbox skills conflict validation helpers. |
| ui/src/lib/a2aErrors.ts | Map substrate/A2A proxy capacity errors to friendly text. |
| ui/src/lib/a2aClient.ts | Use A2A error formatter for proxy error messages. |
| ui/src/lib/tests/sessionTitle.test.ts | Tests for title derivation + placeholder logic. |
| ui/src/lib/tests/sessionTimestamps.test.ts | Tests for timestamp validation/normalization/merge. |
| ui/src/lib/tests/sandboxAgentForm.test.ts | Tests for substrate sandbox form mapping + chat mode helpers. |
| ui/src/lib/tests/agentSkillsForm.test.ts | Tests for substrate skills conflict validation. |
| ui/src/lib/tests/a2aErrors.test.ts | Tests for A2A error formatting. |
| ui/src/components/substrate/SubstrateStatusView.tsx | Update empty-state copy to include substrate sandbox agents. |
| ui/src/components/sidebars/SessionsSidebar.tsx | Use sandbox chat-mode abstraction for sidebar behavior. |
| ui/src/components/sidebars/GroupedChats.tsx | Support multi-session “New Chat” provisioning for substrate sandbox. |
| ui/src/components/chat/ChatLayoutUI.tsx | Normalize new-session events; plumb substrate sandbox context flag. |
| ui/src/components/chat/ChatInterface.tsx | Handle substrate readiness, error formatting, title renaming, timestamp normalization. |
| ui/src/components/chat/ChatAgentContext.tsx | Add substrate sandbox flag to chat runtime context. |
| ui/src/components/AgentsProvider.tsx | Extend agent form data with sandbox platform + substrate fields. |
| ui/src/components/AgentListView.tsx | Distinguish “Substrate sandbox” rows in agent list. |
| ui/src/app/agents/new/page.tsx | Add substrate sandbox platform selector + disable unsupported skills/runtime fields. |
| ui/src/app/agents/[namespace]/[name]/chat/page.tsx | Pre-provision session for substrate sandbox agents before first message. |
| ui/src/app/actions/agents.ts | Emit sandbox config from form; fetch/delete fallback for SandboxAgents; sandbox-ready polling via sandbox endpoint. |
| scripts/controller-digest-ldflags.sh | Compute -X ldflags for runtime image digests from registry. |
| Makefile | Build controller with embedded runtime digests; adjust build ordering/quoting. |
| helm/kagent-crds/templates/kagent.dev_sandboxagents.yaml | CRD: add sandbox platform/substrate fields + validations (skills unsupported on substrate). |
| helm/kagent-crds/templates/kagent.dev_agents.yaml | CRD: mirror sandbox platform/substrate fields + validations. |
| go/README.md | Document link-time embedding of runtime image digests. |
| go/core/pkg/sandboxbackend/substrate/lifecycle.go | Refactor worker-pool resolution via shared helper. |
| go/core/pkg/sandboxbackend/substrate/lifecycle_shared.go | Add shared worker-pool resolver + env-var sanitization for ActorTemplates. |
| go/core/pkg/sandboxbackend/substrate/lifecycle_delete.go | Add substrate cleanup for SandboxAgent-generated templates. |
| go/core/pkg/sandboxbackend/substrate/lifecycle_actortemplate.go | Add ActorTemplate readiness check (not-found → not ready). |
| go/core/pkg/sandboxbackend/substrate/agents_backend.go | New substrate sandbox backend for SandboxAgent → ActorTemplate generation. |
| go/core/pkg/sandboxbackend/substrate/agent_lifecycle.go | Build SandboxAgent ActorTemplate (digest-pin image; env translation). |
| go/core/pkg/sandboxbackend/substrate/agent_lifecycle_test.go | Tests for ActorTemplate env translation + command construction. |
| go/core/pkg/sandboxbackend/substrate/agent_actor.go | Manage per-session actors (create/resume/suspend/delete) for substrate sandbox chats. |
| go/core/pkg/sandboxbackend/substrate/actor_reachability.go | Wait for actor RUNNING + router /health reachability (Host routing). |
| go/core/pkg/sandboxbackend/substrate/actor_reachability_test.go | Tests for probe Host routing + retry/timeout behavior. |
| go/core/pkg/sandboxbackend/substrate/actor_errors.go | Classify “no free workers” resume failures with sentinel error. |
| go/core/pkg/sandboxbackend/substrate/actor_errors_test.go | Tests for “no free workers” classification wrapper. |
| go/core/pkg/sandboxbackend/routing.go | Route sandbox backend by spec.sandbox.platform. |
| go/core/pkg/sandboxbackend/routing_test.go | Tests for platform validation routing behavior. |
| go/core/pkg/sandboxbackend/filter_translator_owned.go | List filtering: only list owned types for the agent’s sandbox platform. |
| go/core/pkg/sandboxbackend/filter_translator_owned_test.go | Tests ensuring substrate sandbox doesn’t list agent-sandbox types and vice versa. |
| go/core/pkg/sandboxbackend/backend.go | Extend backend interface with OwnedResourceTypesFor. |
| go/core/pkg/sandboxbackend/agentsxk8s/agentsxk8s.go | Implement OwnedResourceTypesFor for agent-sandbox backend. |
| go/core/pkg/app/app.go | Wire substrate sandbox backend + actor backend + router URL into controller/http/A2A. |
| go/core/internal/httpserver/server.go | Pass substrate sandbox actor backend into handlers. |
| go/core/internal/httpserver/handlers/substrate.go | Show SandboxAgent names when listing substrate ActorTemplates. |
| go/core/internal/httpserver/handlers/sessions.go | Allow multiple sessions for substrate sandbox; delete session actor on session deletion. |
| go/core/internal/httpserver/handlers/sessions_test.go | Add substrate multi-session coverage; assert timestamps set on create. |
| go/core/internal/httpserver/handlers/handlers.go | Construct SessionsHandler with substrate actor backend. |
| go/core/internal/httpserver/handlers/agents.go | Include SandboxAgents in unified agent list; validate substrate sandbox spec. |
| go/core/internal/httpserver/handlers/agents_test.go | Update list/get tests for unified Agents + SandboxAgents behavior. |
| go/core/internal/controller/translator/agent/testdata/outputs/tls-with-system-cas-disabled.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/tls-with-disabled-verify.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/tls-with-custom-ca.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/ollama_agent.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/bedrock_agent.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/basic_agent.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/anthropic_agent.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_system_message_from_secret.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_system_message_from_configmap.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_streaming.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_skills.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_security_context.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_scheduling_attributes.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_require_approval.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_proxy.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_proxy_service.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_proxy_mcpserver.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_proxy_mcpserver_custom_timeout.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_proxy_external_remotemcp.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_prompt_template.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_passthrough.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_nested_agent.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_memory.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_mcp_service.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_http_toolserver.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_git_skills.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_extra_containers.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_embedding_provider.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_default_sa.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_custom_sa.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_cross_namespace_tools.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_context_config.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_code.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_allowed_headers.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/testdata/outputs/agent_with_a2a_config.json | Golden output: pin app image by digest. |
| go/core/internal/controller/translator/agent/runtime_test.go | Update runtime tests to expect digest-pinned images. |
| go/core/internal/controller/translator/agent/manifest_builder.go | Use effective runtime selection based on AgentObject (supports substrate sandbox). |
| go/core/internal/controller/translator/agent/imageconfig_test.go | Add tests for digest pinning and link-time injection variables. |
| go/core/internal/controller/translator/agent/digest_testmain_external_test.go | Set default digests for external translator tests. |
| go/core/internal/controller/translator/agent/deployments.go | Resolve runtime images via link-time digests (no tag fallback). |
| go/core/internal/controller/translator/agent/compiler.go | Validate substrate sandbox spec during compile. |
| go/core/internal/controller/translator/agent/adk_api_translator.go | Add ImageConfig digest helpers + link-time digest vars. |
| go/core/internal/controller/sandboxagent_substrate.go | Add substrate-specific finalizer cleanup for SandboxAgent actors/templates. |
| go/core/internal/controller/sandboxagent_controller.go | Extend controller to watch substrate ActorTemplates and run substrate delete cleanup. |
| go/core/internal/controller/reconciler/reconciler.go | Validate substrate sandbox specs + platform availability in reconcile. |
| go/core/internal/a2a/substrate_transport.go | Add Host-routing transport to proxy A2A to substrate actors. |
| go/core/internal/a2a/substrate_sandbox_transport.go | Route substrate sandbox A2A calls per-session using contextId. |
| go/core/internal/a2a/substrate_sandbox_transport_test.go | Tests for close-triggered suspend + contextId extraction. |
| go/core/internal/a2a/a2a_registrar.go | Add substrate session routing transport + updated readiness detection. |
| go/api/v1alpha2/zz_generated.deepcopy.go | Deepcopy support for new sandbox substrate spec fields. |
| go/api/v1alpha2/sandboxagent_types.go | Update SandboxAgent docstring for substrate support. |
| go/api/v1alpha2/agent_types.go | Add sandbox platform/substrate types + runtime/platform helpers + validations. |
| go/api/v1alpha2/agent_spec_validation.go | Enforce substrate sandbox constraints (no skills; Go runtime). |
| go/api/v1alpha2/agent_spec_validation_test.go | Tests for substrate sandbox spec validation rules. |
| go/api/v1alpha2/agent_runtime_test.go | Tests for effective runtime selection with substrate sandbox agents. |
| go/api/config/crd/bases/kagent.dev_sandboxagents.yaml | Base CRD: add sandbox platform/substrate schema + validations. |
| go/api/config/crd/bases/kagent.dev_agents.yaml | Base CRD: add sandbox platform/substrate schema + validations. |
| go/adk/pkg/config/config_materialize.go | Materialize substrate-provided env vars into files for Go ADK startup. |
| go/adk/pkg/config/config_loader_test.go | Tests for env materialization behavior. |
| go/adk/cmd/main.go | Call env materialization before loading agent config. |
Files not reviewed (1)
- go/api/v1alpha2/zz_generated.deepcopy.go: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+43
to
+47
| if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { | ||
| return fmt.Errorf("create directory for %s: %w", path, err) | ||
| } | ||
| if err := os.WriteFile(path, []byte(value), 0o644); err != nil { | ||
| return fmt.Errorf("write %s: %w", path, err) |
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
7cbb8a2 to
133b069
Compare
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
…t into peterj/substrate-declar * 'peterj/substrate-declar' of github.com:kagent-dev/kagent: fix: plumb sandbox substrate config field Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
…t into peterj/substrate-declar * 'peterj/substrate-declar' of github.com:kagent-dev/kagent: add projected SA token and update to new types fix: project substrate ate-api service account token fix: add substrate ate-api bearer auth
…t into peterj/substrate-declar * 'peterj/substrate-declar' of github.com:kagent-dev/kagent: fix types
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
…t into peterj/substrate-declar * 'peterj/substrate-declar' of github.com:kagent-dev/kagent: fix: align substrate actor template env types
…n page Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
3 tasks
EItanya
approved these changes
Jun 11, 2026
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
2228635 to
9ba668f
Compare
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.
this enables running declarative (go) agents inside google substrate sandbox.
note that you'll need install substrate (check instructions here)and then explicitly enable it in kagent values.yaml. By default, we create a single worker pool, but you could manually create a different one and then reference it when creating the agent.