Skip to content
Search docs
Search the docs and jump to the section
Sign in

Connections, capabilities and tools

How Werker reaches external services without hard-coding providers.

Layers

  • Connection (Connection in @werkerai/domain): an adapter name, an optional base URL and a reference to a stored secret. The operator creates connections; the set of adapters is open.
  • Capability (CapabilityRef): a contract Werker owns, identified by name and version, such as a classifier or a reasoning call. A provider's own request format does not leak into it.
  • Implementation (CapabilityImplementation in @werkerai/connections): code that serves one capability version through one adapter.
  • Binding (CapabilityBinding): the operator's choice of connection for a capability.
  • Tool (Tool, create_tool_registry): what programs call. Bound capabilities, sandbox tools and MCP tools share one registry.

bind_capabilities turns bindings into tools: it finds the connection, picks the implementation for that adapter and version, and resolves the secret through a caller-supplied function.

What's built

  • Provider setup: Admin → Connections → Connect. The supported providers, how credentials are sealed and the automatic classify@1 binding are in integrations. Other bindings use the operator CLI.
  • classify@1: label a JSON state against questions (choice, score or bool) and get { answers }. Implemented through pi-ai's classifier API for the typesafe (Jev) and openai adapters (packages/connections/src/capabilities/classify.ts).
  • Bindings: capability_bindings (under RLS) records which connection and model serve a capability for a workspace. pnpm connect --adapter typesafe --key-env TYPESAFE_API_KEY --bind classify@1 --model jev-latest adds the connection and binds it; the model is checked against the adapter's classifier catalogue.
  • In runs: the worker turns the workspace's bindings into tools that Code Mode scripts call as tools.classify(...), each with its own connection's key. They are not offered to the model directly, and Code Mode's own models.* is off. These calls run in the worker, scoped to the run's workspace (see sandboxes). Each call's tokens and cost are added to the run's run_usage row for the bound model (typesafe/jev-latest), so a run's cost and Admin → Usage include them (usage_rows in packages/runtime/src/tools/usage.ts). Where the provider's catalog gives the model no price, as for jev-latest, the tokens are stored and the cost is shown as "Unknown" (model_cost_unknown in packages/rules/src/observability/costs.ts).
  • tools.classify_rows: given with classify@1, the same binding asked one yes/no question about each of many rows (a script's rows, such as a CSV it read from /work). It returns the top rows' indexes and probabilities, never the rows, so they do not pass through the model; limits are in classify_rows_limits (packages/rules/src/classify-rows.ts).
  • shell@1: runs a command in the run's own sandbox (see sandboxes); every workspace has it when the instance has a sandbox host (Admin → Sandboxes).
  • Chat model: a run uses the workspace's oldest connection that offers its model.
  • Model check: workers ask each openai and fireworks connection's GET /models which models its key can use, on start-up, hourly, when a connection is added, and from Admin → Models → Check now (packages/runtime/src/loops/model-check.ts). Results are in connection_models. A catalogue model the provider does not list is not offered; before the first check, every catalogue model is.
  • Allowed models: an admin can limit a workspace to chosen models in Admin → Models (workspace_models; no rows allows every available model). The model menu and queue_run only accept models that are available and allowed.

Factory member tools

Each factory member has an allowed_tools list of unversioned tool names, such as shell and classify. A new member's list comes from the default team's lead or first specialist (/factories/teams): as created, none for a lead and shell and classify for a specialist, less any the workspace does not have. Omitted or empty means no capability or sandbox tools, not all tools. The worker intersects that list with the workspace's bound, implemented capabilities and the instance's available sandbox; a preference cannot grant an unavailable tool. It applies to every turn a member takes in a room, including follow-ups and retries. Standalone agent and workflow runs retain their existing availability. Workflow control tools such as finish_step, ask_members and open_room are not capability tools and are not governed by this list. Factory members are launched through factory threads, not as standalone agents or workflow steps, so those preferences cannot be bypassed.

Service connections

Service tools (GitHub, HTTP APIs, remote MCP servers) are available to runs without a capability-binding step; factory members still need the corresponding allowed tool names. The flows, credential sealing, Code Mode tools for services, Git gateway and limits are in connections.

This page as markdown apps/site/src/content/docs/engineering/capabilities.md