providers

A cognet says what it needs as uses, each naming an interface. Most are filled by the machine — a model your inference sources supply, granted automatically. When nothing does — a cognet's own interface, a model of your own — the agent writes the provider here.

providers/
├── features.provider.ts        # granted as "./providers/features"
└── vision/
    └── scene.provider.ts       # "./providers/vision/scene"

Writing one

A provider implements one interface: say which, report what it is, and write each method as the interface writes it. What it needs of the machine — a model — it declares in engines, as a cognet declares what it needs, and its methods reach each one as this.engines.

// providers/features.provider.ts
import type { Grid, Picture } from "../cognet/interfaces/features@1.interface"

export default defineProvider({
    implements: "@cody/terry/features@1",
    engines: {
        dino: { type: "transform", in: "image", out: "features" },
    },

    describe: () => ({ patch: 16 }),

    async extract(picture: Picture): Promise<Grid> {
        const answer = await this.engines.dino.transform({ kind: "image", … })
        // … the model's answer, as the interface says it
    },
})

defineProvider is ambient. It runs on the agent's side of the boundary; the cognet never learns which provider answered. The provider never bundles a model: the cognet declares the weights it wants in models:, the agent's runtime installs them, and engines asks the machine for one of that kind — resolved like any other, on the supervisor's side for a confined agent. implements and engines are read without running the file, so they are written out. That every method is there is checked when the provider is granted; that each answers as the interface means is axon conform's. A provider whose interface hands out handles also writes release(id).

Granting

In axon.config.ts, by the cognet's own name for the use:

services: {
    features: "./providers/features",
}

Left out, a use is "auto" — and auto picks the agent's provider when it is the agent's only one of that interface. See Services.

Errors

ErrorWhen
SERVICE_INVALIDa grant names a provider that doesn't exist, one that implements another interface, or one missing a method
SERVICE_UNAVAILABLEa required use nothing fills, or a granted provider whose engines the machine cannot serve — the agent does not start