Developing custom Skills


In this article:

For operators

Skills are organised into namespaces to allow development teams to deploy in self-service. Each namespace is associated with the following:

We recommend the operators to set up the app namespace, which is referenced in the official tutorials. This is configured using the values from the PhariaAI Helm chart.

The following is an example configuration based on a fictional GitLab instance https://gitlab.acme.com and OCI registries registry.acme.com:

pharia-kernel:
  namespaces:
    # The Namespace name can be specified in camelCase, and is converted to kebab-case when deployed.
    app:
      # The URL to the corresponding Namespace configuration TOML file.
      # Changes in this file will be automatically applied
      configUrl: "https://gitlab.acme.com/api/v4/projects/123/repository/files/namespace.toml/raw?ref=main"
      # The Container Registry that backs the skill registry for this Namespace
      registry: "registry.acme.com"
      # The base repository in `registry` that backs the skill registry for this Namespace
      # This composes the final repository for each skill e.g. ${baseRepository}/${skillName}
      baseRepository: "app/skills"
  env:
    # The access token for `configUrl`
    - name: NAMESPACES__APP__CONFIG_ACCESS_TOKEN
      valueFrom:
        secretKeyRef:
          name: my-secrets
          key: myConfigAccessToken
    # The user name for accessing `registry`
    - name: NAMESPACES__APP__REGISTRY_USER
      valueFrom:
        secretKeyRef:
          name: my-secrets
          key: myRegistryUser
    # The password or access token for accessing `registry`
    - name: NAMESPACES__APP__REGISTRY_PASSWORD
      valueFrom:
        secretKeyRef:
          name: my-secrets
          key: myRegistryAccessToken

With this configuration, the OCI registry and the configuration file is specified for each namespace in pharia-kernel.namespaces. The credentials to access the namespace configuration file and the OCI registry are specified with pharia-kernel.env.

Additional namespaces can be set up as necessary, for example, if requested by a fictional "Awesome AI Team".

The following is an example configuration with the additional namespace awesome-ai-team:

pharia-kernel:
  namespaces:
    app:
      configUrl: "https://gitlab.acme.com/api/v4/projects/123/repository/files/namespace.toml/raw?ref=main"
      registry: "registry.acme.com"
      baseRepository: "app/skills"
    awesomeAiTeam:
      configUrl: "https://gitlab.my-namespace.com/api/v4/projects/123/repository/files/namespace.toml/raw?ref=main"
      registry: "registry.my-namespace.com"
      baseRepository: "my-namespace"
  env:
    - name: NAMESPACES__APP__CONFIG_ACCESS_TOKEN
      valueFrom:
        secretKeyRef:
          name: my-secrets
          key: myConfigAccessToken
    - name: NAMESPACES__APP__REGISTRY_USER
      valueFrom:
        secretKeyRef:
          name: my-secrets
          key: myRegistryUser
    - name: NAMESPACES__APP__REGISTRY_PASSWORD
      valueFrom:
        secretKeyRef:
          name: my-secrets
          key: myRegistryAccessToken
    - name: NAMESPACES__AWESOME_AI_TEAM__CONFIG_ACCESS_TOKEN
      valueFrom:
        secretKeyRef:
          name: my-namespace-secrets
          key: myNamespaceConfigAccessToken
    - name: NAMESPACES__AWESOME_AI_TEAM__REGISTRY_USER
      valueFrom:
        secretKeyRef:
          name: my-namespace-secrets
          key: myNamespaceRegistryUser
    - name: NAMESPACES__AWESOME_AI_TEAM__REGISTRY_PASSWORD
      valueFrom:
        secretKeyRef:
          name: my-namespace-secrets
          key: myNamespaceRegistryAccessToken

For developers

After publishing the Skills to the associated OCI repository, the developers can deploy them by updating the namespace configuration TOML file.

In the following example, the Skills foo and bar are now deployed. The Skill tag is optional, which defaults to latest:

skills = [
    { name = "foo", tag = "1.0.1" },
    { name = "bar" },
]