Skip to content

feat(libsy): expose Python algorithm execution#87

Open
nachiketb-nvidia wants to merge 1 commit into
nachiketb/libsy-python-target-bindingsfrom
nachiketb/libsy-python-algorithm-bindings
Open

feat(libsy): expose Python algorithm execution#87
nachiketb-nvidia wants to merge 1 commit into
nachiketb/libsy-python-target-bindingsfrom
nachiketb/libsy-python-algorithm-bindings

Conversation

@nachiketb-nvidia

@nachiketb-nvidia nachiketb-nvidia commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Stack

  1. feat(libsy): expose typed Python protocol bindings #88 Protocol bindings
  2. feat(libsy): expose Python target bindings #89 Target bindings
  3. feat(libsy): expose Python algorithm execution #87 Algorithm execution (this PR)
  4. feat(libsy): expose Python run streams #82 Host-driven run streams

Review after #89.

Why

Python hosts need to run Rust-owned algorithms using configured target clients without exposing algorithm implementation or subclassing hooks.

What

  • Add an opaque Algorithm handle with run().
  • Add noop() and random(targets) factories.
  • Add typed Decision values and the RoutedLlmClient protocol.
  • Adapt Python async clients to the Rust RoutedLlmClient trait.
  • Convert target sets into Rust-owned snapshots at factory construction.
  • Add no-op, random-routing, and client-error tests.

How

The adapter releases Python while awaiting the host client and maps the typed response back into the Rust protocol. Algorithm implementations remain Rust-owned and factories return one shared handle type.

What to review

  1. Opaque algorithm and factory API.
  2. Python client adapter and error propagation.
  3. Target snapshot semantics.
  4. Context, request, decision, and response conversions.

Validation

  • cargo fmt --all -- --check
  • cargo clippy -p switchyard-py --all-targets -- -D warnings
  • uv run pytest the protocol, target, and algorithm binding tests (13 passed)

Signed-off-by: nachiketb <nachiketb@nvidia.com>
@nachiketb-nvidia
nachiketb-nvidia force-pushed the nachiketb/libsy-python-algorithm-bindings branch from a5b1a1f to 04e5eed Compare July 17, 2026 18:18
@nachiketb-nvidia
nachiketb-nvidia force-pushed the nachiketb/libsy-python-target-bindings branch from 469528f to b4d1641 Compare July 17, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant