services

package
v0.26.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 89 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildLocalK8sConfig added in v0.21.0

func BuildLocalK8sConfig() (*rest.Config, error)

BuildLocalK8sConfig creates a Kubernetes config for local cluster access

func SetupLogBridges added in v0.26.0

func SetupLogBridges()

SetupLogBridges routes the loggers dependencies use into the current slog default. It must run after the slog handler is installed - logr captures the handler here, so an earlier call pins the wrong one.

The klog and controller-runtime wiring is permanent; the Kubernetes libraries always log through klog. The nah and logrus pieces are interception, needed only until nah and kinm migrate to slog themselves.

Types

type AuditConfig added in v0.8.0

type AuditConfig audit.Options

type Config

type Config struct {
	GitMaxRepoSizeMB                               int      `usage:"Maximum git repository size in MB" default:"100" name:"git-max-repo-size-mb"`
	ModelProxyURL                                  string   `usage:"MCP Tester model proxy base URL; empty disables the model proxy" default:"https://model-service.obot.ai"`
	HTTPListenPort                                 int      `usage:"HTTP port to listen on" default:"8080" name:"http-listen-port"`
	AllowedOrigin                                  string   `usage:"Allowed origin for CORS"`
	ProviderRegistries                             []string `usage:"Local filesystem paths to provider registries (directories) to load providers from"`
	EnableAuthentication                           bool     `usage:"Enable authentication" default:"false"`
	AuthAdminEmails                                []string `usage:"Emails of admin users"`
	AuthOwnerEmails                                []string `usage:"Emails of owner users"`
	LocalAuthInitialOwnerEmail                     string   `usage:"Email address for the initial local-auth owner" env:"OBOT_SERVER_LOCAL_AUTH_INITIAL_OWNER_EMAIL"`
	LocalAuthInitialOwnerSetupToken                string   `usage:"High-entropy setup token for the initial local-auth owner" env:"OBOT_SERVER_LOCAL_AUTH_INITIAL_OWNER_SETUP_TOKEN"`
	LocalAuthInitialOwnerSetupTokenExpirationHours int      `` /* 153-byte string literal not displayed */
	TunnelPeerID                                   string   `usage:"Unique Pod UID of this Obot replica for tunnel peering"`
	TunnelPeerToken                                string   `usage:"Shared internal credential for tunnel peering"`

	MCPOAuthClientExpiration       string                `` /* 158-byte string literal not displayed */
	MCPOAuthClientNativeExceptions []string              `` /* 128-byte string literal not displayed */
	ForceDynamicClient             bool                  `usage:"Force Dynamic Client Registration for MCP OAuth instead of Client ID Metadata Documents"`
	ProductAnalyticsMode           producttelemetry.Mode `usage:"Product analytics mode: consent, on, or off" default:"consent" env:"OBOT_SERVER_PRODUCT_ANALYTICS_MODE"`

	DevMode              bool   `usage:"Enable development mode" default:"false" name:"dev-mode" env:"OBOT_DEV_MODE"`
	DevUIPort            int    `usage:"The port on localhost running the dev instance of the UI" default:"5174"`
	UserUIPort           int    `usage:"The port on localhost running the user production instance of the UI" env:"OBOT_SERVER_USER_UI_PORT"`
	ElectionFile         string `usage:"Use this file for leader election instead of database leases"`
	ForceEnableBootstrap bool   `usage:"Enables the bootstrap user even if other admin users have been created" default:"false"`
	MetricsBearerToken   string `usage:"Bearer token for metrics endpoint authentication" name:"metrics-bearer-token"`

	DefaultMCPCatalogPath                string `usage:"The path to the default MCP catalog (accessible to all users)" default:""`
	DefaultSystemMCPCatalogPath          string `usage:"The path to the default System MCP catalog" default:""`
	MDMAssetSource                       string `` /* 233-byte string literal not displayed */
	DefaultSkillRepoURL                  string `` /* 151-byte string literal not displayed */
	DefaultSkillRepoRef                  string `usage:"The ref (branch/tag) for the default skill repository" default:"" env:"OBOT_DEFAULT_SKILL_REPO_REF"`
	DefaultHostedAgentsCatalogURL        string `` /* 181-byte string literal not displayed */
	DefaultHostedAgentsCatalogRef        string `` /* 132-byte string literal not displayed */
	ModelInfoSourceURL                   string `` /* 174-byte string literal not displayed */
	DisableUpdateCheck                   bool   `usage:"Disable Obot server update checks"`
	HideK8sDetails                       bool   `usage:"Hide Kubernetes configuration details such as the Server Scheduling page from the UI" default:"false"`
	EnableRegistryAuth                   bool   `usage:"Enable authentication for the MCP registry API" default:"false" env:"OBOT_SERVER_ENABLE_REGISTRY_AUTH"`
	EnableMessagePolicies                bool   `usage:"Enable message policies for LLM proxy content enforcement" default:"false"`
	LLMAuditLogRetentionDays             int    `usage:"Number of days to retain LLM audit logs (0 to disable cleanup)." default:"90"`
	DisableLLMAuditLog                   bool   `usage:"Disable LLM gateway audit logging" default:"false"`
	DeviceScanRetentionDays              int    `usage:"Number of days to retain submitted device scans (0 to disable cleanup)." default:"90"`
	EnableAgents                         *bool  `` /* 272-byte string literal not displayed */
	EnableHostedAgents                   bool   `usage:"Enable Hosted Agents features" default:"false"`
	HostedAgentsBackend                  string `` /* 275-byte string literal not displayed */
	HostedAgentsStorageClassName         string `` /* 185-byte string literal not displayed */
	HostedAgentsPodSecurityLevel         string `` /* 315-byte string literal not displayed */
	HostedAgentsImagePullPolicy          string `` /* 174-byte string literal not displayed */
	HostedAgentsCleanupImage             string `` /* 166-byte string literal not displayed */
	HostedAgentsRuntimeClassName         string `usage:"RuntimeClass for hosted agent deployments" name:"hosted-agents-runtime-class-name"`
	HostedAgentsAffinity                 string `usage:"Affinity rules for hosted agent pods (JSON)" name:"hosted-agents-affinity"`
	HostedAgentsTolerations              string `usage:"Tolerations for hosted agent pods (JSON)" name:"hosted-agents-tolerations"`
	HostedAgentsNodeSelector             string `usage:"Node selector for hosted agent pods (JSON)" name:"hosted-agents-node-selector"`
	MCPServerSearchImage                 string `usage:"Container image for the obot MCP server" default:"ghcr.io/obot-platform/obot-mcp-server:v0.2.0"`
	NanobotAgentImage                    string `usage:"Container image for the Nanobot agent MCP server" default:"ghcr.io/obot-platform/nanobot-agent:v0.0.92"`
	MCPNetworkPolicyProviderChartRepo    string `usage:"Helm repository URL for the network policy provider chart"`
	MCPNetworkPolicyProviderChartName    string `usage:"Helm chart name for the network policy provider chart"`
	MCPNetworkPolicyProviderChartVersion string `usage:"Helm chart version for the network policy provider chart"`
	MCPNetworkPolicyProviderChartPath    string `usage:"Local filesystem path to the network policy provider chart"`
	MCPNetworkPolicyProviderValues       string `usage:"YAML or JSON values blob merged into the network policy provider chart values"`
	MCPDefaultDenyAllEgress              bool   `usage:"Default new MCP servers to deny all egress when network policy enforcement is enabled" default:"false"`

	// Published artifact storage
	ArtifactStorageProvider       string `` /* 143-byte string literal not displayed */
	ArtifactStorageBucket         string `usage:"Bucket for published artifacts" name:"artifact-storage-bucket" env:"OBOT_ARTIFACT_STORAGE_BUCKET"`
	ArtifactS3Region              string `usage:"S3 region for artifact storage" name:"artifact-s3-region" env:"OBOT_ARTIFACT_S3_REGION"`
	ArtifactS3AccessKeyID         string `usage:"S3 access key ID for artifact storage" name:"artifact-s3-access-key-id" env:"OBOT_ARTIFACT_S3_ACCESS_KEY_ID"`
	ArtifactS3SecretAccessKey     string `` /* 127-byte string literal not displayed */
	ArtifactS3Endpoint            string `usage:"Custom S3 endpoint for artifact storage" name:"artifact-s3-endpoint" env:"OBOT_ARTIFACT_S3_ENDPOINT"`
	ArtifactGCSServiceAccountJSON string `` /* 185-byte string literal not displayed */
	ArtifactAzureStorageAccount   string `` /* 135-byte string literal not displayed */
	ArtifactAzureTenantID         string `usage:"Azure tenant ID for artifact storage" name:"artifact-azure-tenant-id" env:"OBOT_ARTIFACT_AZURE_TENANT_ID"`
	ArtifactAzureClientID         string `usage:"Azure client ID for artifact storage" name:"artifact-azure-client-id" env:"OBOT_ARTIFACT_AZURE_CLIENT_ID"`
	ArtifactAzureClientSecret     string `usage:"Azure client secret for artifact storage" name:"artifact-azure-client-secret" env:"OBOT_ARTIFACT_AZURE_CLIENT_SECRET"`

	GatewayConfig
	EncryptionConfig
	AuditConfig
	RateLimiterConfig
	MCPConfig
	LicenseConfig
	storageservices.Config
}

type EncryptionConfig added in v0.8.0

type EncryptionConfig encryption.Options

type GatewayConfig

type GatewayConfig gserver.Options

type LicenseConfig added in v0.23.0

type LicenseConfig license.Config

type MCPConfig added in v0.8.0

type MCPConfig mcp.Options

type RateLimiterConfig added in v0.8.0

type RateLimiterConfig ratelimiter.Options

type Services

type Services struct {
	GitMaxRepoSizeMB      int
	EncryptionConfig      *encryptionconfig.EncryptionConfiguration
	StorageClient         storage.Client
	StorageDB             *kinmdb.Factory
	Router                *router.Router
	PersistentTokenServer *persistent.TokenService
	APIServer             *server.Server
	GatewayClient         *client.Client
	ProxyManager          *proxy.Manager
	ProviderDispatcher    *dispatcher.Dispatcher
	Otel                  *otel.Otel
	AuditLogger           audit.Logger
	DSN                   string
	ServerURL             string
	// LocalServerURL is Obot's address as Obot itself can reach it, which differs
	// from ServerURL when the public port is mapped by a Service or ingress.
	LocalServerURL string
	// AgentServerURL is Obot's address as a sandbox can reach it, which differs
	// from ServerURL when Obot runs outside the cluster its sandboxes run in.
	AgentServerURL    string
	MCPSessionManager *mcp.SessionManager
	TunnelManager     *tunnel.Manager
	OAuthServerConfig handlers.OAuthAuthorizationServerConfig

	// Global token storage client for MCP OAuth
	MCPOAuthTokenStorage         mcp.GlobalTokenStore
	MCPSecretBindingAllowedLabel string
	RegistryNoAuth               bool

	PostgresDSN                   string
	ProviderRegistryPaths         []string
	DevUIPort                     int
	DevMode                       bool
	UserUIPort                    int
	GatewayServer                 *gserver.Server
	Bootstrapper                  *bootstrap.Bootstrap
	LocalAuthProvider             *localauth.Provider
	AuthEnabled                   bool
	DefaultMCPCatalogPath         string
	DefaultSystemMCPCatalogPath   string
	MDMAssetSource                string
	DefaultSkillRepoURL           string
	DefaultSkillRepoRef           string
	DefaultHostedAgentsCatalogURL string
	DefaultHostedAgentsCatalogRef string
	ModelInfoSourceURL            string

	// Used for indexed lookups of access control rules.
	AccessControlRuleHelper *accesscontrolrule.Helper

	// Used for indexed lookups of model access policies.
	ModelAccessPolicyHelper *modelaccesspolicy.Helper

	// Used for indexed lookups of skill access rules.
	SkillAccessRuleHelper *skillaccessrule.Helper

	// Used for indexed lookups of hosted agent access rules.
	HostedAgentAccessRuleHelper *hostedagentaccessrule.Helper

	MCPOAuthClientSecretExpiration time.Duration
	MCPOAuthClientNativeExceptions []string
	ForceDynamicClient             bool
	ProductTelemetryConsent        *producttelemetry.Consent
	ProductTelemetryPublisher      *producttelemetry.Publisher

	// LocalK8sClient is a kclient for the local Kubernetes cluster — the
	// cluster the obot pod runs in, where source Secrets for
	// secretBindings live. Nil on the docker backend.
	LocalK8sClient            kclient.Client
	LocalRouter               *router.Router
	K8SEveryReplicaRouter     *router.Router
	EveryReplicaRouter        *router.Router
	MCPServerNamespace        string
	ServiceAccountIssuerURL   string
	ServiceAccountIssuerError string
	MCPClusterDomain          string
	ServiceName               string
	ServiceNamespace          string
	ServiceAccountName        string
	StorageListenPort         int

	// ObotNamespace is the Kubernetes namespace in which the obot server
	// runs; mcp.MergeBoundCreds reads source Secrets from here.
	ObotNamespace string

	// Parsed settings from Helm for k8s to pass to controller
	// PodSchedulingSettingsFromHelm contains affinity, tolerations, resources, runtimeClassName
	// when explicitly set via Helm. If non-nil, SetViaHelm=true and UI cannot modify these.
	PodSchedulingSettingsFromHelm *v1.K8sSettingsSpec
	// PSASettingsFromHelm contains Pod Security Admission settings, always sourced from
	// environment/Helm config and not modifiable via UI.
	PSASettingsFromHelm *v1.PodSecurityAdmissionSettings

	HideK8sDetails          bool
	MCPRuntimeBackend       string
	MCPImagePullSecrets     []string
	MCPHTTPWebhookBaseImage string
	MessagePoliciesEnabled  bool
	EnableAgents            *bool
	HostedAgentsEnabled     bool
	AgentBackend            agentbackend.Backend
	AgentBackendKind        string
	// AgentDevRouter reaches sandboxes from outside the cluster. It is set only
	// in development; in production Obot runs in-cluster and the sandbox address
	// resolves directly.
	AgentDevRouter                       agentconnect.DevRouter
	MCPNetworkPolicyEnabled              bool
	MCPDefaultDenyAllEgress              bool
	MCPServerSearchImage                 string
	NanobotAgentImage                    string
	MCPNetworkPolicyProviderChartRepo    string
	MCPNetworkPolicyProviderChartName    string
	MCPNetworkPolicyProviderChartVersion string
	MCPNetworkPolicyProviderChartPath    string
	MCPNetworkPolicyProviderValues       string
	SingleUserIdleServerShutdownInterval time.Duration
	MultiUserIdleServerShutdownInterval  time.Duration
	AgentIdleServerShutdownInterval      time.Duration

	// Published artifact blob storage
	ArtifactBlobStore  blob.BlobStore
	ArtifactBlobBucket string

	// License provider
	LicenseProvider *license.Provider
	VersionChecker  *upgrade.VersionChecker

	ModelProxyConfiguredURL string
	ModelProxyURL           *url.URL
}

func New

func New(ctx context.Context, config Config) (*Services, error)

func (*Services) AgentsEnabled added in v0.26.0

func (s *Services) AgentsEnabled(ctx context.Context) (bool, error)

AgentsEnabled returns the effective state of the agents feature.

An explicitly configured value always wins. When the setting is unset, deployments that already contain agents are grandfathered in while new deployments keep the feature disabled.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL