Skip to content

Harden provider contracts for Worker-backed agent routing #87

@stackbilt-admin

Description

@stackbilt-admin

Intent

Harden @stackbilt/llm-providers as the reusable provider/capability layer behind a Cloudflare Worker API router for coding-agent clients.

The Worker should be able to delegate model choice, structured-output handling, tool capability checks, failover, cache hints, and provider request/response normalization through public library contracts.

Use Case

The downstream gateway wants to expose Ollama/OpenAI/Anthropic-compatible endpoints while routing each request to the best available model:

  • cheap JSON/structured-output model
  • tool-safe model
  • code model
  • Workers AI LoRA reviewer/critic model
  • frontier fallback
  • local/remote provider bridge

Contract Surfaces To Review

  • canonical request/response shape
  • route preflight/introspection
  • cache hint semantics
  • provider/model capability metadata for JSON, tools, streaming, multimodal, LoRA, and code tasks
  • fallback and degradation explanations
  • response normalization for compatibility endpoints

Acceptance Criteria

  • A Worker/router can ask for route selection using a canonical request without provider-specific branching.
  • Capability metadata is expressive enough to choose models for JSON, tools, code, structured output, and LoRA-backed reviewer paths.
  • Cache hints are concrete enough for a Worker implementation using KV/Cache API/D1/R2 without baking Cloudflare storage into the library.
  • Route inspection returns enough explanation for a gateway debug endpoint.
  • Public docs include a gateway/router integration example that avoids private Stackbilt-only assumptions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions