feat(policy-engine): add OrcaRouter as a named llm annotator provider - #3802
feat(policy-engine): add OrcaRouter as a named llm annotator provider#3802JinhaoSong322 wants to merge 1 commit into
Conversation
Add the OrcaRouter gateway as a first-class `orcarouter` provider preset alongside OpenAI, OpenAI-compatible, Azure OpenAI, Bedrock, Gemini, and Ollama in the bundled `llm` annotator dispatcher. The preset points at https://api.orcarouter.ai/v1/chat/completions by default, reads ORCAROUTER_API_KEY, and defaults to the orcarouter/auto gateway model. An explicit `endpoint` or `base_url` overrides the default; a gateway-root `base_url` has /chat/completions appended. Responses use the OpenAI chat-completions shape, so the existing content extraction path applies unchanged. URL-sourced manifests keep the existing fail-closed behavior and never read the host ORCAROUTER_API_KEY. Registration points updated: Rust dispatcher enum + dispatch, constants, the manifest JSON schema (core + spec), the llm-annotator-providers docs, and the ACS specification section 10. Unit tests cover the default endpoint/key/model, explicit endpoint, base_url appending, base_url with full path, and the URL-sourced credential restriction. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: JinhaoSong322 <jinhao.song@myflashcloud.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Welcome to the Agent Governance Toolkit! Thanks for your first pull request. |
PR Review Summary
Verdict: AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims. |
|
🔴 Contributor Check: HIGH
Automated check by AGT Contributor Check. |
|
JinhaoSong322 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Problem & Solution
The bundled
llmannotator dispatcher in the policy engine ships named provider presets for OpenAI, OpenAI-compatible, Azure OpenAI, Bedrock, Gemini, and Ollama. This PR adds OrcaRouter as another first-class named preset (provider: orcarouter), so a manifest can route its LLM judge through the OrcaRouter gateway the same way it would through any other named provider.OrcaRouter is an OpenAI-compatible model gateway that aggregates open-weight and frontier models behind one endpoint. It also runs gateway-level, zero-trust security for AI agents on the same endpoint — screening every prompt/response and governing every tool call on a default-deny basis, with no application code changes.
Impact on Your Work
Running LLM annotators through OrcaRouter gives deployments a single base URL for many model families plus gateway-level guardrails on judge traffic, configured purely from the ACS manifest (
provider,model,api_key_env) with no host code changes.Timeline
None.
Alternatives Considered
The repo already models a generic
openai_compatiblepreset that would accept any endpoint, but a namedorcarouterpreset matches the existing first-class provider pattern (same treatment as OpenAI, Bedrock, Gemini, etc.) and keeps the schema self-documenting, exactly like the other named presets.Type of Change
Package(s) Affected
Governance & security:
Testing
Unit Testing
Added 5 unit tests in
policy-engine/core/src/dispatchers/llm.rs:orcarouter_default_uses_gateway_endpoint_key_and_model— default URL (https://api.orcarouter.ai/v1/chat/completions), default key env (ORCAROUTER_API_KEY), default model (orcarouter/auto), JSON response format.orcarouter_supports_explicit_endpoint_and_key— explicitendpoint+model+api_key_envare honored.orcarouter_base_url_appends_chat_completions— a gateway-rootbase_urlgets/chat/completionsappended.orcarouter_base_url_with_full_path_is_kept— a full-pathbase_urlis used unchanged.url_sourced_orcarouter_does_not_read_default_env_key— a URL-sourced manifest never reads the hostORCAROUTER_API_KEY(fail-closed parity with the OpenAI regression test).Full run:
cargo test --workspacepasses. The single pre-existing failure (host::tests::from_path_zero_config_evaluates_rego_manifest) requires the externalopaCLI and fails identically on cleanmain; it is unrelated to this change.cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings, andpython scripts/docs/check_links.pyare clean.Manual Testing
Live end-to-end against the real OrcaRouter gateway using the new provider path (
ORCAROUTER_API_KEYfrom the environment,LlmAnnotator::dispatch):provider: orcarouterwith default endpoint/model →{"label":"allow","raw":"{\"label\": \"allow\"}"}base_url: https://api.orcarouter.ai/v1→{"label":"deny",...}(200)endpoint: https://api.orcarouter.ai/v1/chat/completions→{"label":"deny",...}(200)Checklist
Attribution & Prior Art
Prior art / related projects (if any):
The named-provider pattern mirrors the existing
openai/openai_compatible/bedrock/gemini/ollamapresets already in this dispatcher.AI Assistance
IP, Patents, and Licensing
Disclosure: I'm an engineer on the OrcaRouter team.