Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c459572
feat(guardrails): speak the Straiker v3 platform API (/api/v3/detect)
PhimmStraiker Sep 18, 2026
9654f1a
feat(guardrails): name the agent per application on v3 (x-s6r-agent)
PhimmStraiker Sep 18, 2026
bf5deb7
docs(guardrails): which v3 shape is scored depends on the connector, …
PhimmStraiker Sep 18, 2026
daa46d0
fix(guardrails): send exactly what the unified Kong plugin sends on v3
PhimmStraiker Sep 18, 2026
edba86d
test(guardrails): sort imports in the v3 session test
PhimmStraiker Sep 18, 2026
f614ff2
fix(straiker): send a streamed Messages answer back in the Messages s…
PhimmStraiker Sep 18, 2026
b94a50a
style(straiker): ruff format the v3 guardrail and its tests
PhimmStraiker Sep 18, 2026
e339df9
refactor(straiker): one attempt per call in the webhook retry loop
PhimmStraiker Sep 18, 2026
8adfacf
fix(straiker): name Claude Code's client and agent on v3 so its sessi…
PhimmStraiker Sep 18, 2026
9d0f1c1
refactor(straiker): build the v3 request, envelope and headers as fro…
PhimmStraiker Sep 18, 2026
14e0a72
fix(straiker): satisfy basedpyright on the v3 builders
PhimmStraiker Sep 18, 2026
2c8295a
fix(straiker): type the v3 config fields at the initializer and keep …
PhimmStraiker Sep 18, 2026
bf5f5d9
fix(straiker): address review findings on the v3 relay
PhimmStraiker Sep 18, 2026
7657c13
fix(straiker): scrub tool credentials one level deep, without recursion
PhimmStraiker Sep 19, 2026
92552aa
fix(straiker): scrub only the fields that carry a credential, never a…
PhimmStraiker Sep 19, 2026
eaf2923
test(straiker): use example.com identities; drop a comment that resta…
PhimmStraiker Sep 19, 2026
14da28c
fix(straiker): present a legacy completion as the chat exchange it is
PhimmStraiker Sep 19, 2026
fb39fed
fix(straiker): screen a completions prompt as the text the model rece…
PhimmStraiker Sep 19, 2026
516b33c
fix(straiker): seed the derived session on the preamble and the first…
PhimmStraiker Sep 19, 2026
2e37ea2
fix(straiker): seed the derived session on every text block of the fi…
PhimmStraiker Sep 19, 2026
8cf1885
test(straiker): cover the tokenizer fallback, a textless first turn a…
PhimmStraiker Sep 19, 2026
7e5c45a
fix(straiker): seed the derived session on the principal as well as t…
PhimmStraiker Sep 20, 2026
033c868
fix(straiker): derive the session id with sha256 and drop comments th…
PhimmStraiker Sep 20, 2026
b132333
fix(straiker): keep a blocked conversation blocked when it is replayed
PhimmStraiker Sep 20, 2026
0a98a9b
fix(straiker): scope the block memory by session or principal, never …
PhimmStraiker Sep 20, 2026
57e1318
fix(straiker): remember only a block that names a control, never one …
PhimmStraiker Sep 21, 2026
190c92e
Merge the Straiker v3 guardrail onto BerriAI main
PhimmStraiker Sep 23, 2026
5378c7e
Merge BerriAI main into the Straiker v3 guardrail branch
PhimmStraiker Sep 23, 2026
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
22 changes: 21 additions & 1 deletion litellm/proxy/guardrails/guardrail_hooks/straiker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from typing import TYPE_CHECKING, Final
from typing import TYPE_CHECKING, Final, Literal

from pydantic import BaseModel

import litellm
from litellm.types.guardrails import SupportedGuardrailIntegrations
Expand All @@ -8,6 +10,14 @@
if TYPE_CHECKING:
from litellm.types.guardrails import Guardrail, LitellmParams


class _V3Routing(BaseModel):
api_version: Literal["v1", "v3"] | None = None
agent_ref: str | None = None
client: str | None = None
format_hint: Literal["anthropic.messages", "openai.chat"] | None = None


_OPTIONAL_INIT_FIELDS: Final = (
"timeout",
"max_retries",
Expand Down Expand Up @@ -48,13 +58,23 @@ def initialize_guardrail(litellm_params: "LitellmParams", guardrail: "Guardrail"
for value in [_get_config_value(litellm_params, optional_params, field)]
if value is not None
}
routing: Final = _V3Routing.model_validate(
{
field: _get_config_value(litellm_params, optional_params, field)
for field in ("api_version", "agent_ref", "client", "format_hint")
}
)
_callback: Final = StraikerGuardrail(
api_key=api_key,
api_base=api_base if isinstance(api_base, str) else "https://api.prod.straiker.ai",
source=source,
guardrail_name=guardrail.get("guardrail_name", "straiker"),
event_hook=litellm_params.mode,
default_on=litellm_params.default_on,
api_version=routing.api_version,
agent_ref=routing.agent_ref,
client=routing.client,
format_hint=routing.format_hint,
**kwargs,
)

Expand Down
Loading
Loading