Skip to content

Custom mcp servers in agentruntime, and model + provider persistence - #4050

Open
michaeljguarino wants to merge 4 commits into
masterfrom
agent-improvements
Open

Custom mcp servers in agentruntime, and model + provider persistence#4050
michaeljguarino wants to merge 4 commits into
masterfrom
agent-improvements

Conversation

@michaeljguarino

@michaeljguarino michaeljguarino commented Aug 24, 2026

Copy link
Copy Markdown
Member

this will allow users to more easily extend their runtimes, and the model/provider persistence should improve cost tracking e2e.

Test Plan

Test environment: https://console.plrldemo.onplural.sh/cd/clusters/a1748282-ce8b-48ab-ae7e-326e74fce04e/services/f3f89a54-d1a7-4bc8-9152-daa07ede918d/settings/helm

Checklist

  • I have added a meaningful title and summary to convey the impact of this PR to a user.
  • If required, I have updated the Plural documentation accordingly.
  • I have added tests to cover my changes.
  • I have deployed the agent to a test environment and verified that it works as expected (required only when changing agent code).

Plural Flow: console

@michaeljguarino
michaeljguarino requested a review from a team August 24, 2026 15:42
@michaeljguarino michaeljguarino added the enhancement New feature or request label Aug 24, 2026
@soffi-ai

soffi-ai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Soffi AI Summary

This PR delivers three distinct enhancements to the Plural Console platform:

  1. Custom MCP servers & model/provider persistence in AgentRuntime: Users can now configure a default model and AI provider override directly on an AgentRuntime. This model preference is persisted end-to-end (CRD → GraphQL → UI), improving cost tracking by ensuring runs are attributed to the correct model/provider. The frontend runtime selector and creation/edit flows are updated to surface this configuration.

  2. Preview environment TTL and maximum limits: PreviewEnvironmentTemplate CRDs now support a previewTtl field (Kubernetes duration string, e.g. 1d, 5s) that controls how long preview environments live before expiring. The Flow CRD gains a maxPreviews field (1–25, default 10) to cap the number of concurrent preview environments per flow. Both fields are wired through GraphQL, the Go client, CRD manifests, and the generated TypeScript types.

  3. Knowledge loop in Workbench creation: A new KnowledgeSubStep component is introduced in the workbench create/edit flow, enabling users to configure a knowledge/context loop for AI agent workbench sessions. This is surfaced as a dedicated step within the multi-step workbench form.

Additionally, the Cluster CRD gains mergeTags support, allowing tag maps to be merged rather than replaced during reconciliation, along with comprehensive new controller tests for cluster attributes and tag merging behavior.

Changes

Default model and provider override for AgentRuntime

  • Adds a model field to the AgentRuntime CRD and GraphQL type, allowing users to set a default AI model and provider for all runs on that runtime. Wires the field through the Go client, controller reconciler, CRD YAML manifests, and the React runtime selector/creation UI to enable cost tracking by model/provider. (b29e5cd)

Knowledge loop in Workbench creation flow

  • Introduces a new KnowledgeSubStep component and integrates it into the multi-step workbench create/edit form, allowing users to configure a knowledge/context loop for AI agent workbench sessions. Adds supporting GraphQL queries and fragments. (2b83d06)

Preview environment TTL and maximum limits

  • Adds previewTtl (Kubernetes duration string) to PreviewEnvironmentTemplate and maxPreviews (1–25, default 10) to Flow CRDs, controlling how long preview environments live and how many can exist concurrently per flow. Fields are wired through the Go client, CRD manifests, GraphQL schema, and generated TypeScript types. (4b0e92d)

Cluster CRD mergeTags support

  • Extends the Cluster CRD with a mergeTags field that merges tag maps during reconciliation instead of replacing them. Adds comprehensive controller and type-level tests covering attribute merging and tag behavior. (f8db8c0)

Updated: 2026-08-25 20:54 UTC

Deploy in Soffi

@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds custom remote MCP servers to agent runtimes and persists runtime model/provider attribution for downstream cost tracking.

  • Adds MCP server CRD configuration, header resolution, AgentRun secret transport, and Claude, Codex, Gemini, OpenCode, and Pi harness integration.
  • Adds runtime model inference, GraphQL/OpenAPI fields, an embedded database column, and generated client/schema updates.
  • Existing AgentRun secrets do not currently refresh when only their MCP configuration or credentials change.

Confidence Score: 4/5

The PR should not merge until AgentRun secrets correctly refresh when MCP configuration or referenced credentials change.

The new MCP payload is written into the run secret, but the reconciliation guard never compares it, allowing removed servers and rotated credentials to remain in durable execution configuration.

Files Needing Attention: go/deployment-operator/internal/controller/agentrun_controller.go

Important Files Changed

Filename Overview
go/deployment-operator/internal/controller/agentrun_controller.go Adds resolved MCP configuration to AgentRun secrets, but the existing-secret comparison ignores that payload and leaves changed configuration stale.
go/deployment-operator/internal/controller/mcp.go Resolves configured MCP servers and secret-backed headers into the harness payload with contextual error handling.
go/deployment-operator/api/v1alpha1/agentruntime_types.go Adds the MCP server CRD contract and propagates inferred runtime model attributes.
go/deployment-operator/api/v1alpha1/agentruntime_model.go Infers persisted provider/model attribution from AI-proxied runtime configuration with tested provider mappings.
go/deployment-operator/pkg/agentrun-harness/mcp/servers.go Loads and validates serialized external MCP server configuration for harness integrations.
lib/console/schema/agent_runtime.ex Persists the runtime model as a validated embedded provider/model pair.
priv/repo/migrations/20260824150329_add_runtime_model.exs Adds the nullable map column required for runtime model persistence.

Reviews (1): Last reviewed commit: "Custom mcp servers in agentruntime, and ..." | Re-trigger Greptile

Comment on lines 511 to +513
if !r.hasSecretData(secret.Data, run) {
logger.V(2).Info("updating secret", "namespace", secret.Namespace, "name", secret.Name)
secret.StringData = r.getSecretData(run, config, runtime.Spec.Type, signingKey, exaConnection)
secret.StringData = r.getSecretData(run, config, runtime.Spec.Type, signingKey, exaConnection, mcpServers)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 MCP secret state stays stale

When an MCP server is removed, its configuration changes, or a referenced header credential rotates, hasSecretData still returns true because it compares only the deploy token, Console URL, and run ID. The reconciliation therefore leaves the existing PLRL_MCP_SERVERS value unchanged, causing recreated agent containers to reuse stale endpoints, permissions, or credentials.

Knowledge Base Used: Deployment operator

@michaeljguarino
michaeljguarino force-pushed the agent-improvements branch 2 times, most recently from 401d1c6 to 83e5e78 Compare August 24, 2026 16:30
@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot

Copy link
Copy Markdown
Contributor

Deployment GitOps PR: https://github.com/pluralsh/plrl-up-demos/pull/2696

Console is pinned to sha-83e5e78 from head 83e5e782ea1659310ba6b0c6324d2c2a5acef1dd. The GitOps PR is annotated Plural Service: mgmt/apps.

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot

Copy link
Copy Markdown
Contributor

GitOps deployment PR has been created: https://github.com/pluralsh/plrl-up-demos/pull/2697

It pins the console image tag sha-eabcc2c from head eabcc2c38fb05908618ee7266875561a1dbb6c37.

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot

Copy link
Copy Markdown
Contributor

Deployment PR created: https://github.com/pluralsh/plrl-up-demos/pull/2698 — it pins the demo Console image to sha-0d326fe (PR #4050 head 0d326fe).

@michaeljguarino
michaeljguarino force-pushed the agent-improvements branch 2 times, most recently from 173795f to ce68c15 Compare August 24, 2026 21:49
@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot plural-copilot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deployment requested — the GitOps deployment PR has been created: https://github.com/pluralsh/plrl-up-demos/pull/2699

It deploys console image tag sha-ce68c15 from head SHA ce68c1568a0d24896157cb97bad50a9a87f43830 and is annotated for Plural Service: mgmt/apps.

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot

Copy link
Copy Markdown
Contributor

Deployment GitOps PR: https://github.com/pluralsh/plrl-up-demos/pull/2701

this will allow users to more easily extend their runtimes, and the model/provider persistence should improve cost tracking e2e.
@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot

Copy link
Copy Markdown
Contributor

Deployed via GitOps: https://github.com/pluralsh/plrl-up-demos/pull/2702 — pins the demo console deployment to sha-2b83d06.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant