Skip to main content

Agent workload reference

An agent runs in a workload: the agent harness component, any tool components, and hostInterfaces entries that grant each cosmonic:agent interface to the components that may use it. This page lists those entries and their config keys.

In Cosmonic Desktop, Desktop writes the workload for each session; you don't apply it yourself. On Cosmonic Control, you write it, as a Workload or WorkloadDeployment (runtime.wasmcloud.dev/v1alpha1), and the spec is the approval.

Entry fields​

Each cosmonic:agent entry in spec.hostInterfaces:

FieldValue
namespacecosmonic
packageagent
versionA 0.4.x version. Desktop writes 0.4.0; Control's examples use 0.4.1. A component built against any 0.4.x links to it.
interfacesThe interfaces this entry serves. One plugin serves each group below, so each group is its own entry.
nameOptional. A workload may have one unnamed cosmonic:agent entry; name the others (see each entry).
configString keys and string values. Lists are comma separated.
secretFromOptional. Secrets whose keys are merged into config (Control).

Every value in config is a string. Per-component values are written component: items; component: items, for example github: list-pulls, get-pull; wiki: search.

The key components means the same on every entry: the components the entry is granted to, comma separated. Only those components are linked to the interface, and an entry that names none grants none.

Session​

Grants session: the conversation journal and working state.

Interfacessession
Namecosmonic-agent-session on Control when another cosmonic:agent entry is unnamed
KeyHostMeaning
componentsDesktop, ControlThe components that work in the workload's conversation, usually agent.
tool-componentsDesktop, ControlTool components that each get a store of their own. A tool never gets the conversation.

On Control, an entry with neither key is refused. The conversation is scoped to the namespace and WorkloadDeployment, shared by its replicas.

Inference​

Grants models and chat (and the inference-types they use): models by alias.

InterfacesDesktop writes inference-types, models, chat; Control's examples use models, chat
NameNone for the entry that answers every alias. On Control, a name makes the entry answer only the alias it names.
KeyHostMeaning
componentsDesktop, ControlThe components that may open models and chat.
backendDesktop, ControlThe model source, by name. On Control, source is the same key.
sourceControlThe model source, by its name in agents.models.sources. Optional when the host has one.
modelDesktop, ControlA model of that source. Without it, the source's default model.
max-requests, max-tokensDesktop, ControlNarrow the source's limits for this workload. Never raise them.

The endpoint and the key belong to the host. Keys such as base-url, url, endpoint, api-key, key, token and authorization are refused.

Tools​

Grants tools: the tools the host lists and calls for the agent.

Interfacestools
Namecosmonic-agent-tools on Control when another entry is unnamed
KeyHostMeaning
componentsDesktop, ControlThe agent components granted tools. Required on Control.
tool-componentsControlComponents of the same workload whose exported functions are the tools. Without it, no tools.
tool-functionsControlPer tool component, the functions offered. Without it, every function.
tool-aliasesControlPer tool component, renames for the model, such as wiki: search=wiki_search.
toolsets-selectionDesktopapproved: the session's tools are the ones the person approved for it. Written by Desktop.
toolsets-profileDesktopA profile name from the operator's toolsets.yaml.

On Control, tool components must be typed tools: components that export their own interfaces and nothing from cosmonic:agent. Each keeps its own localResources (allowedHosts, volume mounts) and its own instance pool. A tool call has a 30-second deadline.

In Desktop, a session's tools are components of its workload, each with its own grants. Changing them is a new revision.

Run​

Grants the host's driver the agent's run export. Exporting run gives the agent nothing.

Interfacesrun
Namecosmonic-agent-run on Control when another entry is unnamed

In Desktop, you never write this entry. Desktop adds it when a session starts, and refuses a manifest that names run.

On Control:

KeyRequiredMeaning
componentsyesThe component whose cosmonic:agent/run@0.4.x export the triggers call.
triggersyeshttp, nats, or http,nats. The host must have each trigger turned on.
max-duration-secsnoA run's default and longest wall-clock time, 1 to 3600 seconds. Default 600.
hostnoAn extra Host header the HTTP trigger answers.
auth-tokennoA bearer token every HTTP request must carry, at least 16 bytes. Supply it with secretFrom.

A workload that also serves wasi:http cannot take the HTTP trigger.

Components and placement​

FieldValue
Agent component nameAny name the entries' components key uses. Desktop names it agent.
Agent localResources.allowedHosts[]. The host makes model calls, so the agent needs no egress.
Tool localResources.allowedHostsThe hosts that tool calls, and no others.
hostSelector (Control)cosmonic.io/agents: 'true', the label hosts with agent support set on themselves.
imagePin by digest (@sha256:…) in production. Desktop pins agent and tool images by digest itself.

Example (Control)​

apiVersion: runtime.wasmcloud.dev/v1alpha1
kind: WorkloadDeployment
metadata:
  name: research-agent
  namespace: default
spec:
  replicas: 1
  template:
    spec:
      hostSelector:
        cosmonic.io/agents: 'true'
      hostInterfaces:
        - namespace: cosmonic
          package: agent
          interfaces: [models, chat]
          version: 0.4.1
          config:
            components: agent
            source: openai
        - namespace: cosmonic
          package: agent
          interfaces: [tools]
          version: 0.4.1
          name: cosmonic-agent-tools
          config:
            components: agent
            tool-components: github
        - namespace: cosmonic
          package: agent
          interfaces: [session]
          version: 0.4.1
          name: cosmonic-agent-session
          config:
            components: agent
        - namespace: cosmonic
          package: agent
          interfaces: [run]
          version: 0.4.1
          name: cosmonic-agent-run
          config:
            components: agent
            triggers: http,nats
      components:
        - name: agent
          image: ghcr.io/cosmonic-labs/components/minimal-agent:0.3.1
          localResources:
            allowedHosts: []
        - name: github
          image: ghcr.io/example/tools/github@sha256:…
          localResources:
            allowedHosts:
              - api.github.com

Host settings (Control)​

These HostGroup chart values must be set for the entries above to work. Run an agent on Cosmonic Control walks through them.

ValueMeaning
agents.enabledTurns on the agent plugins and labels hosts cosmonic.io/agents: "true".
agents.models.sourcesThe model sources: name, baseUrl, defaultModel, models, existingSecret, limits, features.
agents.sessions.storage.key.existingSecretname, key and namingKey of the Secret that encrypts sessions. Required for session.
agents.sessions.storage.backend.natsThe JetStream KV bucket (bucket, default cosmonic-agent-sessions), replicas, maxBytes and credentials.
agents.run.http.enabled, agents.run.nats.enabledTurn on the HTTP and NATS triggers. Both off by default.
agents.run.nats.subjectPrefixThe NATS subject prefix. Default cosmonic.agents.