Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .agents/skills/switchyard-codebase-exploration/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ description: Use when modifying, debugging, reviewing, refactoring, renaming, re

> Rust crates under `crates/` are active on the Rust core branch. Inspect
> `crates/switchyard-core`, `crates/switchyard-components`,
> `crates/switchyard-components-v2`, `crates/switchyard-server`,
> `crates/switchyard-translation`, `crates/switchyard-py`, and `crates/*/tests`
> `crates/switchyard-server`, `crates/switchyard-translation`,
> `crates/switchyard-py`, and `crates/*/tests`
> directly when a change touches Rust.
> Direct PyO3 bindings for concrete components live under
> `crates/switchyard-py/src/component_bindings/` with Python lazy exports in
Expand Down
4 changes: 2 additions & 2 deletions .agents/skills/switchyard-coding-agent-launchers/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ Route YAML and launchers share this model-dispatch path:
- `type: passthrough` registers the YAML key and discovered direct models.
- `type: random_routing` registers the YAML key as the routing profile plus
direct strong/weak passthrough entries.
- `type: deterministic` and `type: stage_router` register the route key plus direct
strong/weak passthrough entries.
- `type: deterministic`, `type: escalation_router`, and `type: stage_router`
register the route key plus direct strong/weak passthrough entries.
- `type: plan_execute` registers the route key plus the executor as a direct
passthrough; the planner is internal routing logic.
- `type: latency_service` and `type: noop` register the
Expand Down
8 changes: 3 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,8 @@ and their transitives never appear in downstream vulnerability scans.
export OPENAI_API_KEY="sk-..." # or NVIDIA_API_KEY / ANTHROPIC_API_KEY where supported
export OPENROUTER_API_KEY="sk-or-..." # pass with --api-key or save via configure

# Serve a profile config (passthrough, random-routing, llm-routing, stage_router).
# Endpoints, targets, and profiles live in the YAML; see docs/routing_algorithms/overview.md.
switchyard serve --config profiles.yaml --port 4000
switchyard serve --config profiles.yaml --inbound anthropic --port 4000
# Serve a routing bundle. Routes live in YAML; see docs/routing_algorithms/overview.md.
switchyard --routing-profiles routes.yaml -- serve --port 4000

# One-command launchers — single-model passthrough via --model
switchyard launch claude --model openai/gpt-4o-mini \
Expand Down Expand Up @@ -291,7 +289,7 @@ uv run mypy switchyard
1. Pick the right stage: request component (pre-call), response component (post-call), `LLMBackend` (rare), or Rust translation codec work.
2. Create a file with the explicit name (`snake_case` of the class name), one class per file.
3. Implement the async method for that stage (`process` for components, `call` for backends).
4. Wire into the owning profile config.
4. Wire into the owning programmatic profile config or route-bundle builder.
5. Add tests under `tests/`.
6. Export from the relevant `__init__.py` and from `switchyard/__init__.py`'s `__all__`.

Expand Down
52 changes: 0 additions & 52 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ members = [
"crates/libsy",
"crates/libsy-llm-client",
"crates/switchyard-components",
"crates/switchyard-components-v2",
"crates/switchyard-components-v2-macros",
"crates/switchyard-core",
"crates/switchyard-py",
"crates/protocol",
Expand Down
68 changes: 26 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ write yourself.
**Launcher routing is explicit.** By default, launchers use the built-in
LLM-classifier router, which you tune with `--weak-model`, `--classifier-model`,
`--profile`, and `--classifier-min-confidence`. Use `--model X` for
single-model passthrough. The `--routing-profiles FILE` path is deprecated and
remains only for launcher-owned legacy bundles.
single-model passthrough or `--routing-profiles FILE` for a YAML route bundle.

## Features

Expand Down Expand Up @@ -72,12 +71,12 @@ switchyard launch openclaw --model openai/gpt-4o-mini --api-key "$OPENROUTER_API
```

Each launcher starts a local proxy, points the agent at it, and shuts the proxy
down when the agent exits. Use `--model` for single-model passthrough. The
deprecated `--routing-profiles` flag remains for launcher-owned legacy bundles:
down when the agent exits. Use `--model` for single-model passthrough or
`--routing-profiles` for a route bundle:

```bash
switchyard launch claude --model openai/gpt-4o-mini --base-url https://openrouter.ai/api/v1 # single-model passthrough
switchyard --routing-profiles routes.yaml -- launch claude # legacy route bundle
switchyard --routing-profiles routes.yaml -- launch claude # route bundle
```

> **Bedrock-backed profile caveat (Claude Code + MCP):** Bedrock enforces a 64-character `toolSpec.name` cap. Claude Code's MCP bridge can auto-inject longer tool names, producing `BedrockException` 400s on tool-bearing requests. If you use a Bedrock-backed route and hit this, swap to an OpenAI-compatible model with `--model openai/gpt-4o` or a routing-profile YAML.
Expand All @@ -86,58 +85,39 @@ See [Agent Launchers](docs/guides/agent_launchers.md) for supported harness
versions, model requirements, troubleshooting, and Claude Code `/model` picker
aliasing.

### 2. Run a standalone profile-config server
### 2. Run a standalone Python server

New standalone deployments use a profile config that separates provider
connectivity, upstream targets, and client-facing profiles. A complete
OpenRouter-backed random-routing config looks like this:
Define one or more client-facing routes in YAML. A complete OpenRouter-backed
random-routing bundle looks like this:

```yaml
endpoints:
openrouter:
api_key: ${OPENROUTER_API_KEY}
base_url: https://openrouter.ai/api/v1

targets:
strong:
endpoint: openrouter
model: openai/gpt-4o
format: openai
weak:
endpoint: openrouter
model: openai/gpt-4o-mini
format: openai

profiles:
defaults:
api_key: ${OPENROUTER_API_KEY}
base_url: https://openrouter.ai/api/v1
format: openai

routes:
smart:
type: random-routing
strong: strong
weak: weak
type: random_routing
strong:
model: openai/gpt-4o
weak:
model: openai/gpt-4o-mini
strong_probability: 0.3
fallback_target_on_evict: strong
```
Serve it as a proxy. The `smart` profile and both target ids are exposed as
models; clients select one through the request's `model` field:
Serve it as a proxy. The route name is exposed as a model ID, and clients
select it through the request's `model` field:

```bash
switchyard serve --config profiles.yaml --port 4000
switchyard --routing-profiles routes.yaml -- serve --port 4000
curl http://localhost:4000/v1/models
curl http://localhost:4000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "smart", "messages": [{"role": "user", "content": "hi"}]}'
```

> **Launcher compatibility:** Launcher subcommands do not accept `--config`.
> The deprecated `--routing-profiles` flag remains for launcher-owned legacy
> `routes:` bundles and saved bundle paths:

```yaml
routes:
fast:
type: model
target: openai/gpt-4o-mini
```

```bash
switchyard --routing-profiles routes.yaml -- launch claude
switchyard --routing-profiles routes.yaml -- configure --target provider \
Expand All @@ -148,6 +128,10 @@ switchyard --routing-profiles routes.yaml -- configure --target provider \
Non-interactive `configure` does not read provider credentials from the routing
bundle; pass `--api-key` explicitly when persisting the bundle for CI.

The Rust `switchyard-server` binary has a separate explicit TOML schema for
LLM clients, targets, and libsy algorithms. See
[`crates/switchyard-server/README.md`](crates/switchyard-server/README.md).

For profile selection and full configuration examples, start with
[Routing Overview](docs/routing_algorithms/overview.md), then open the
strategy-specific page:
Expand Down
20 changes: 0 additions & 20 deletions crates/switchyard-components-v2-macros/Cargo.toml

This file was deleted.

Loading
Loading