Deploy agents

Deploy agents using the AgentService custom resource by preparing required resources manually and creating the Agent Manager route after the ZAssistantDeploy custom resource is created.

Before you begin

Ensure the following:
  • Access to the OpenShift cluster
  • Appropriate permissions to create secrets and custom resources
  • Agent Helm charts available in the agent-helm-charts directory
  • Access to an OCI-compliant container registry
  • Authentication credentials for the container registry

About this task

This procedure covers creating the global secret required by deployed agents, creating the OpenShift route for Agent Manager, and providing reusable YAML definitions for both resources.

Procedure

  1. Create a global secret.

    You need to create the global secret in the core-services namespace after applying the CR for ZAssistantDeploy. For example, wxa4z-zad. See Deploying ZAssistantDeploy on your cluster.

    This shared secret is used by the agents deployed through the AgentService custom resource. This is a one-time setup.

    Create a file named global-secret.yaml with the following content:

    apiVersion: v1
    kind: Secret
    metadata:
      name: wxa4z-watsonx-credentials
      namespace: <your-namespace>  # Replace with your target Kubernetes namespace
    type: Opaque
    stringData:
      ORCHESTRATE_ENV_TYPE: ""  # Deployment type: "cpd" (on-premises) or "ibm_iam" (IBM Cloud)
      ORCHESTRATE_ENV_URL: ""  # watsonx Orchestrate service instance URL
      CPD_USERNAME: ""  # CPD username — required for on-premises deployments
      CPD_INSTANCE_API_KEY: ""  # CPD instance API key — required to register the agent with Orchestrate
      WATSONX_DEPLOYMENT_SPACE_ID: ""  # Watsonx deployment space ID — leave empty if not applicable
      WATSONX_ML_URL: ""  # CPD instance FQDN (on-premises) or WML endpoint (IBM Cloud) — required when MODEL_RUNTIME is "on-prem" or "cloud"
      EXTERNAL_WATSONX_API_KEY: ""  # API key for the CPD instance hosting the LLM
      WATSONX_PROJECT_ID: ""  # Watsonx project ID — leave empty if not applicable
      MODEL_RUNTIME: ""  # Required: "on-prem", "cloud", or "openai_protocol"
      LLM_BASE_URL: ""  # Inferencing stack base URL — required when MODEL_RUNTIME is "openai_protocol"
      LLM_API_KEY: ""  # Inferencing stack API key — required when MODEL_RUNTIME is "openai_protocol"
      LANGFUSE_SECRET_KEY: ""  # Langfuse secret key — optional, for observability integration
      LANGFUSE_HOST: ""  # Langfuse host URL — optional, for observability integration
      WRAPPER_USERNAME: ""  # Wrapper service username — leave empty; auto-populated in tenant namespace
      WRAPPER_URL: ""  # Wrapper service URL — leave empty; auto-populated in tenant namespace. Append "/v1/query" after population
      WRAPPER_PASSWORD: ""  # Wrapper service password — leave empty; auto-populated in tenant namespace
      TENANT_ID: ""  # Tenant identifier — optional
      INGESTION_URL: ""  # Document ingestion service URL — optional
      INGESTION_PASSWORD: ""  # Document ingestion service password — optional
    For more information on the configuration variables, see the Quick Start guide.
    Note: After the tenant is created, update the WRAPPER_URL endpoint in the wxa4z-watsonx-credentials secret (within the tenant namespace) by appending /v1/query.
  2. Apply the global secret to the cluster.
    oc apply -f global-secret.yaml
  3. Create a custom resource YAML file named AgentService with the following content.
    Before applying the CR, verify the following:
    • The agent-specific secret is created.
    • The image pull secret for the image artifact is created.
    apiVersion: wxa4z.watsonx.ibm.com/v1alpha1
    kind: AgentService
    metadata:
      name: [agent-service-cr-name] # Example: upgrade-agent-test
      namespace: [tenant-namespace]
      labels:
        wxa4z.watsonx.ibm.com/managed-by: agent-operator
    
    spec:
      releaseName: [release-name]
      tenantId: [tenant-id]
      namespace: [tenant-namespace]
      wxa4z-core-services-namespace: wxa4z-zad # Namespace for opensearch-client, authorization
    
      agentDetails:
        - agentName: [agent-name-1]
          agentId: wxa4z:[agent-name-1]:agent
          displayName: [agent display name]
          description: [agent description]
          bootstrapConfig:
            name: [bootstrap configmap name]
            fileName: [bootstrap config file name]
    
      chart:
        repository: [repository name] # Example: oci://icr.io/wxa4z-dev-container-registry
        name: [agent helm tar.gz name] # Example: upgrade-agent
        version: [helm tar.gz version]
        pullSecrets: # If not specified, defaults to pull-secret
          - name: pull-secret # Secret containing image repository credentials
    
      values:
        replicaCount: 1
    
        global:
          secrets:
            name: wxa4z-watsonx-credentials # Reference to global variables
    
        secrets:
          name: [agent-secrets] # Example: upgrade-agent-secrets
    
        env: # Configurable environment variables
          HOST_NAME: "apps.wxa4z311-cpd530-x86-qa.cp.fyre.ibm.com"

    Replace placeholder values in square brackets with your actual values.
  4. Apply the AgentService custom resource to the cluster.
    oc apply -f agent-service.yaml
    The AgentService custom resource is created and the agents are deployed.

Results

The agents are deployed using the AgentService custom resource. The global secret is available for all deployed agents, and the Helm chart is stored in the container registry for deployment.