Providers / MVP

Writing a provider type

How an inference provider publishes a Convoy provider type. The convoy-provider.hcl manifest, presets over a built-in driver, driver plugins on the Python plugin SDK, and how to test and release.

View .md

A provider type is a git repository named convoy-provider-<name> with one file at its root, convoy-provider.hcl. Convoy never runs your code to learn your schema: it reads the manifest. Start from the preset if an existing driver can reach your endpoint, and write a driver plugin only if your models need your own agent SDK.

The manifest uses the same syntax and type expressions as a .cvy file, and convoy provider validate reports problems with file and line.

A preset

A preset reuses a built-in driver. This one puts Acme’s Chat Completions endpoint behind openai_compatible (Acme, its endpoint, and its prices are invented):

convoy-provider.hcl
provider "acme" {
  description = "Acme Inference, Chat Completions API"
  driver      = "openai_compatible"

  driver_config = {
    base_url = attr.base_url
    api_key  = attr.api_key
    headers  = { "X-Acme-Tier" = attr.tier }
  }

  driver_settings = {
    temperature = setting.temperature
  }
}

attribute "api_key" {
  type        = env_name
  default     = "ACME_API_KEY"
  description = "The variable in convoyd's environment that holds the Acme API key."
}

attribute "base_url" {
  type        = string
  default     = "https://api.acme.example/v1"
  description = "The Chat Completions endpoint."
}

attribute "tier" {
  type        = string
  default     = "standard"
  enum        = ["standard", "priority"]
  description = "The service tier requests run at."
}

setting "temperature" {
  type        = number
  min         = 0
  max         = 2
  description = "Sampling temperature."
}

model "acme-large-1" {
  price = { input = 3, output = 12, cache_read = 0.3 }
}

model "acme-small-1" {
  price      = { input = 0.2, output = 0.8 }
  deprecated = "Retires on 2027-03-01. Use acme-small-2."
}

A swarm then writes:

HCL
provider "fast" {
  source = "acme/acme"
  tier   = "priority"
}

driver_config turns your attributes into the driver’s, and driver_settings turns your settings into the driver’s. Both are expressions over attr.<name> (and setting.<name> in driver_settings), using the language’s pure functions; file and env are not available. They are type-checked when the manifest is parsed, so a typo or a value the driver cannot take is your error (PM012), not your users’. An unset setting is null, and a null result is not passed. An env_name attribute passes through by reference (api_key = attr.api_key); the built-in driver decides the variable name in the runner.

The endpoint must support what the driver uses. For openai_compatible that is streaming and function calling, because the swarm tools and the local tools reach the model as function tools. A preset offers its driver’s tools, which for openai_compatible are bash, read_file, write_file and edit_file; tools = ["bash", "read_file"] in the provider block offers a subset.

A driver plugin

A driver plugin ships its own driver, which runs as the agent’s process. convoyd starts your command for each agent with --start-file start.json appended:

convoy-provider.hcl
provider "acme_agents" {
  description = "Acme models through the Acme Agents SDK"
  command     = ["uv", "run", "--project", "{package}", "--frozen", "--no-dev", "convoy-provider-acme-agents"]
  contracts   = [2]
}

attribute "api_key" {
  type        = env_name
  default     = "ACME_API_KEY"
  inject_as   = "ACME_API_KEY"
  description = "The variable in convoyd's environment that holds the Acme API key."
}

tool "web_search" { description = "Search the web." }
tool "bash" { description = "Run shell commands in the agent's folder." }

model "acme-large-1" {
  price = { input = 3, output = 12 }
}
  • {package} in command is replaced by the package folder’s absolute path. command[0] is looked up on the runner’s PATH, unless it starts with {package}/.
  • contracts lists the runner contract versions your code supports. convoyd refuses a version with none in common with its own.
  • Every env_name attribute needs inject_as: the variable your process receives its value under.
  • tool blocks declare the built-in tools an agent may list. Where a tool does what one of Convoy’s names does (web_search, bash, read_file, write_file, edit_file, code_interpreter, file_search), use that name, so a swarm can change providers without renaming tools.

The code

Your package depends on convoy-runner, which is also the plugin SDK. You supply a driver; serve supplies the turn loop, the API client, the transcript recorder, check mode, and the exit codes.

pyproject.toml
[project]
name = "convoy-provider-acme-agents"
version = "1.0.0"
requires-python = ">=3.12"
dependencies = ["convoy-runner>=0.2", "acme-agents>=3"]

[project.scripts]
convoy-provider-acme-agents = "convoy_provider_acme_agents:main"
convoy_provider_acme_agents/__init__.py
from convoy_runner.plugin import Session, StartArgs, TurnResult, Usage, serve


class AcmeDriver:
    def check(self) -> None:
        import acme_agents  # noqa: F401  (check mode: fail if the SDK is missing)

    async def start(self, args: StartArgs) -> None:
        # args: system_prompt, model, config, settings, tools, mcp_url, token,
        # swarm_tools, output_schema, cwd, session_id, recorder
        ...

    async def turn(self, user_input: str) -> TurnResult:
        ...
        return TurnResult(text=text, usage=Usage(input_tokens=i, output_tokens=o),
                          session=Session(sdk_session_id=session_id))

    async def close(self) -> None:
        ...


def main() -> None:
    serve(AcmeDriver)

A driver must:

  • connect its SDK to the MCP server at mcp_url with the bearer token, and let the model call the swarm tools;
  • allow the tools in tools, and no other built-in tool;
  • keep one SDK session across turn calls;
  • return the turn’s token counts in TurnResult.usage and a session id in TurnResult.session; convoyd prices the turn from your manifest’s model prices;
  • call recorder.add for each block the SDK completes (reasoning, tool calls and results, text), so the Web UI shows the transcript.

config holds your attributes with defaults applied, except env_name ones, whose values arrive in the environment under inject_as. settings holds only the settings that are set. The repository’s examples/provider_plugin is a complete skeleton with each step marked.

Dependencies install themselves

convoyd installs nothing. It fetches your package and runs your command, and a launcher such as uv run --project {package} --frozen builds the plugin’s environment from your committed uv.lock the first time it starts, then reuses it. Each version gets its own environment with pinned, hash-checked dependencies.

To make that first start happen once and before any agent runs, convoyd starts your command in check mode when a run is created, and after a pull or push: --check instead of --start-file. serve builds your driver, calls its check() if it has one, prints one line, and exits 0:

JSON
{"contracts":[2],"runner_version":"0.2.0"}

Anything else refuses the run with provider_check_failed and the end of your output. The check gets PATH and HOME only: no token and no key. It needs uv on the runner’s PATH, and network access the first time a version starts.

Only Python driver plugins are supported for now, because the runner library also assembles each agent’s prompts. Each run records the runner_version a plugin’s check reported.

The manifest

Exactly one provider block, whose label is the type’s name and equals the <name> of the address it is published under.

AttributeKindDescription
descriptionboth, requiredOne line, shown by convoy provider list
driverpresetA built-in type whose driver runs this type’s agents
driver_configpresetThe built-in type’s attributes, as an expression over attr.<name>
driver_settingspresetThe built-in type’s settings, as an expression over attr.<name> and setting.<name>
toolspresetThe subset of the built-in type’s tools this type offers. Default: all of them
commanddriver pluginThe runner command. {package} stands for the package folder
contractsdriver plugin, requiredThe runner contract versions the code supports
open_modelsbothWhen true, a model outside the catalog is accepted without TS019. Default false
formatbothThe manifest format. Default and only value: 1

Set exactly one of driver and command.

attribute blocks declare the attributes of a swarm’s provider block; setting blocks declare the keys of settings.

AttributeInDescription
typeboth, requiredstring, number, bool, list(...), map(...), or an object type. An attribute may also be env_name
defaultbothFor an attribute: when absent, the attribute is required; null makes it optional and unset. For a setting: when absent, the setting is unset unless a swarm sets it
descriptionboth, requiredShown in generated documentation
enumbothThe allowed values
patternbothAn RE2 expression a string must match in full
min, maxbothBounds of a number, inclusive
inject_asattributeFor env_name in a driver plugin, required: the variable the value is set under in the runner
deprecatedbothWhen set, using it is TS070 with this text

An env_name value is the name of a variable in convoyd’s environment, written as a literal string matching ^[A-Z_][A-Z0-9_]*$, never the secret, so no secret enters a bundle or the store. A manifest may not declare an attribute named source, version, sdk, model, price, or settings.

A model block’s label is the model name exactly as a swarm writes it. It has price (optional; { input, output, cache_read, cache_write } in USD per million tokens, the cache prices defaulting to input), description, and deprecated. A model with no price is known but unpriced. A tool block has a required description.

Test and release

Terminal
$ convoy provider validate              # the manifest, offline
provider validate: ok (acme, a preset over openai_compatible: 3 attributes, 1 settings, 4 tools, 2 models)

$ convoy provider docs > PROVIDER.md    # your reference, as Markdown

$ convoy provider push . --source acme/acme      # install on your convoyd as 0.0.0-dev
$ convoy provider test acme/acme@0.0.0-dev --model acme-large-1 --set tier=priority
testing acme/acme 0.0.0-dev sha256:4b1e0c9d2a7f… on run 1 of provider_test_acme_acme
ok   the run ended done (it is done)
ok   the transcript has a tool_call for list_topics
ok   the first turn reported input and output tokens
ok   the agent reported a session id
provider test: ok

convoy provider test runs a one-agent swarm on your type and checks what Convoy’s own drivers are tested for. It spends real tokens. For a preset it answers the first question you will have: whether the endpoint supports what the driver needs. push replaces an earlier push of the same version, so you can repeat it while you work.

To release:

  1. Name the repository convoy-provider-<name>, with convoy-provider.hcl at its root.
  2. For a driver plugin, commit uv.lock.
  3. Tag v<semver>, such as v1.0.0. Never move a tag: convoyd records each version’s digest and refuses a tag whose files changed. Publish a new version instead.

Users then write source = "<namespace>/<name>", and their convoyd fetches your tag the first time a swarm names it.

Manifest codes

convoy provider validate reports these; every one is an error. The server reports the same ones as provider_manifest_invalid when it fetches a version.

CodeRule
PM001Exactly one provider block, whose label matches ^[a-z][a-z0-9_]*$
PM002A required attribute is missing, an attribute or block type is unknown, a value has the wrong type, or the file does not parse
PM010Not exactly one of driver and command
PM011driver is not a built-in type, or tools lists a tool the built-in type does not offer
PM012driver_config or driver_settings references an attribute or setting the manifest does not declare, or does not produce the built-in type’s attributes or settings
PM013An attribute or block of the other kind: tool blocks, contracts, or inject_as in a preset; driver_config, driver_settings, or tools in a driver plugin
PM020A duplicate or invalid name, or an attribute named like a core attribute
PM021An invalid type; a default or enum value that does not fit; pattern on a non-string or min/max on a non-number; an invalid pattern
PM022env_name on a setting; an env_name attribute with no inject_as in a driver plugin; inject_as on another type or not a variable name; an env_name default that is not a variable name
PM030A model price is malformed
PM040contracts is missing, empty, or lists a number below 1; format is not supported
PM041command is empty, or a {package} path in it leaves the package
Last updated 2026-11-05
esc
    ↑↓ to move · ↵ to open
    Menu
    Get started
    IntroductionInstallQuickstartYour first swarm
    Concepts
    Swarms and runsAgents and turnsTopics and the boardThe overseerSpawning agentsBudgets and limits
    DSL
    Language rulesswarmprovidertopicagentReferences and functionsValidation rules
    Providers
    Provider typesUsing a provider typeWriting a provider type
    CLI
    Overviewconvoy goalconvoy validateconvoy runconvoy statusconvoy watchconvoy sayconvoy stopconvoy uiconvoy provider
    Runtime
    convoydControllerMessage boardRunnerSwarm tools (MCP)Web UIDurability
    Architecture
    OverviewRepository layoutSeams and contractsHTTP API
    Examples
    OverviewWriter and criticResearch teamCode teamPaperBench replicationCommit0 libraryVending-BenchSWE-Lancer bountyτ²-bench loop
    Inspiration
    What we borrowedThe harness landscape