conduct-litellm-guard
Conduct Guard as a LiteLLM guardrail. Every LLM call routed through LiteLLM runs through your active Guard policy before the request leaves your network — block, warn, audit, or trigger a HITL approval, with the same signed configuration and hash-chained audit log as the rest of Conduct.
Install
pip install conduct-litellm-guard
Wire it up
- Mint an agent token in the Conduct console
(Settings → Agent identities). Copy the
cond_agt_…value. - Export it in the environment where your LiteLLM proxy runs:
export CONDUCT_AGENT_TOKEN=cond_agt_...
- Add the guardrail to your LiteLLM proxy's
config.yaml:guardrails: - guardrail_name: conduct-guard litellm_params: guardrail: conduct_litellm_guard.ConductGuard mode: pre_call api_url: https://api.conductai.ai agent_token: os.environ/CONDUCT_AGENT_TOKEN fail_mode: fail_closed
- Start the proxy:
litellm --config config.yaml
A full example lives in examples/config.yaml.
What the guardrail does
For every incoming request the guardrail calls Conduct's guard_check
tool (JSON-RPC over the MCP endpoint) with a compact summary of the
LiteLLM request — model, call type, message count, temperature, stream
flag, plus the last user message so the audit trail carries context.
Guard returns one of five verdicts:
| Verdict | LiteLLM behaviour |
|---|---|
ok / allow |
Request forwarded to the upstream model. |
advisory |
Forwarded, metadata.conduct_guard annotated. |
WARNING |
Forwarded, warning surfaced in metadata. |
BLOCKED |
LiteLLM returns an error to the caller. No upstream token spent. |
PENDING approval |
Blocked pending HITL. Caller receives an error citing the rule. |
Configuration reference
| Field | Required | Default | Notes |
|---|---|---|---|
api_url |
no | https://api.conductai.ai |
Point at a self-hosted Conduct API when needed. |
agent_token |
yes | CONDUCT_AGENT_TOKEN env |
cond_agt_* token minted in the Conduct console. |
workspace_id |
no | resolved from the token | Usually unnecessary — the token owns its workspace. |
fail_mode |
no | fail_closed |
fail_closed blocks when Guard is unreachable, fail_open allows. |
timeout |
no | 8.0 |
Seconds. Guard checks return in <100ms in the healthy path. |
Session tracking
Guard uses a session ID to correlate the pre-call check with any resume-verdict / HITL approval that follows. The adapter picks the first value it finds in this order:
litellm_metadata.trace_idmetadata.X-Conduct-Session-Id(explicit override — set this if you want deterministic control over the session boundary).metadata.conduct_session_id.- A deterministic hash of the
userfield plus the first user message.
If none of the above are available and the caller sends no user or
messages, session tracking is skipped (single-shot mode). Approvals
still work — they just can't be resumed against a prior check.
Fail modes
fail_closed(default) — blocks the call if Guard is unreachable or the policy evaluator errors. Matches Conduct's default posture across every other enforcement surface.fail_open— allows the call and logs a warning. Use during rollout or if Guard is a soft dependency for your setup.
License
conduct-litellm-guard is distributed under the same
FSL-1.1-MIT license as the rest of Conduct. On
2028-08-23 it converts to MIT.
Links
- Conduct Guard — the policy engine.
- Conduct Router — Conduct's own LLM proxy.
- Source — this package lives
under
packages/conduct-litellm-guard/. - Issues — file bugs and requests against the parent repo.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file conduct_litellm_guard-0.1.0.tar.gz.
File metadata
- Download URL: conduct_litellm_guard-0.1.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98d6d46ee78e1c34151c300a4a9fc15789da10bb7299b26411f01a0908dc53bc
|
|
| MD5 |
0fc4c353e26dfd63dd8cd42da4b99b1b
|
|
| BLAKE2b-256 |
d9271b192746c0cb70f9f966fd95c362b628b1e163471610d79c2a54d39c68bb
|
Provenance
The following attestation bundles were made for conduct_litellm_guard-0.1.0.tar.gz:
Publisher:
publish-litellm-guard.yml on sseshachala/conductai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
conduct_litellm_guard-0.1.0.tar.gz -
Subject digest:
98d6d46ee78e1c34151c300a4a9fc15789da10bb7299b26411f01a0908dc53bc - Sigstore transparency entry: 2581801019
- Sigstore integration time:
-
Permalink:
sseshachala/conductai@8e8b156874cf7a1d3d73a4d018014524c6966ee5 -
Branch / Tag:
refs/tags/litellm-guard/v0.1.0 - Owner: https://github.com/sseshachala
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-litellm-guard.yml@8e8b156874cf7a1d3d73a4d018014524c6966ee5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file conduct_litellm_guard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: conduct_litellm_guard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
468b3b159751b72e3ad411f7987d736465a86d9539bbf7a736711f1e2b12af95
|
|
| MD5 |
c541da06bc9e8ae220f20e041ab5333d
|
|
| BLAKE2b-256 |
0c45e615b4e831557efcfbc8c4db9daf285a6ae62dd4da0220bc931cf36f750f
|
Provenance
The following attestation bundles were made for conduct_litellm_guard-0.1.0-py3-none-any.whl:
Publisher:
publish-litellm-guard.yml on sseshachala/conductai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
conduct_litellm_guard-0.1.0-py3-none-any.whl -
Subject digest:
468b3b159751b72e3ad411f7987d736465a86d9539bbf7a736711f1e2b12af95 - Sigstore transparency entry: 2581801030
- Sigstore integration time:
-
Permalink:
sseshachala/conductai@8e8b156874cf7a1d3d73a4d018014524c6966ee5 -
Branch / Tag:
refs/tags/litellm-guard/v0.1.0 - Owner: https://github.com/sseshachala
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-litellm-guard.yml@8e8b156874cf7a1d3d73a4d018014524c6966ee5 -
Trigger Event:
push
-
Statement type: