Skip to content

Feature/walled ai#240

Draft
JohnPraveenYL wants to merge 11 commits intodevelopfrom
Feature/walledAI
Draft

Feature/walled ai#240
JohnPraveenYL wants to merge 11 commits intodevelopfrom
Feature/walledAI

Conversation

@JohnPraveenYL
Copy link

@JohnPraveenYL JohnPraveenYL commented Feb 25, 2026

Description

This PR implements WalledAI Guardrails to enhance the security and privacy of agent interactions. It introduces automated input safety checks, PII (Personally Identifiable Information) masking/redaction for incoming requests, and a mechanism to unmask sensitive data in the agent's output before it reaches the user.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update
  • CI/CD update
  • Other (please describe):

Related Issues

Fixes #
Relates to #

Changes Made

  • Integrated generic safety check to block unsafe or harmful messages.
  • Implemented PII Masking: Automatically detects and replaces sensitive data in user inputs with placeholders.
  • Added a silent_call utility to suppress SDK-level print statements for cleaner logs.
  • Implemented exception handling for INPUT_SHORT errors to prevent the guardrail from crashing on trivial inputs.
  • Leveraged session._data to store PII mappings (walledai_pii_mapping), ensuring the context is preserved across the request-response lifecycle.
  • Created a mechanism to intercept agent replies and replace placeholders with the original values stored in the session, ensuring the user receives the full context while the model only sees masked data.

Testing

  • Unit tests pass locally
  • Integration tests pass locally
  • Manual testing completed
  • New tests added for changes

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

@amithad
Copy link
Member

amithad commented Feb 26, 2026

@JohnPraveenYL You need to add documentation as to how to use WalledAI. README files in relevant places. And documentation pages.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for WalledAI-based guardrails to Agent Kernel and provides a CLI/LangGraph demo showcasing input safety checks plus PII masking/unmasking.

Changes:

  • Introduce WalledAI input/output guardrail implementations and wire them into the guardrail factories + config validation.
  • Add walledai optional dependency (and lockfile updates) for agentkernel.
  • Add a runnable CLI demo package under examples/cli/guardrail/walledai (scripts, config, docs, and tests).

Reviewed changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
examples/cli/guardrail/walledai/pyproject.toml Defines a standalone demo project and dependencies.
examples/cli/guardrail/walledai/demo_test.py Adds example-level tests for the demo (currently requires real WALLED_API_KEY).
examples/cli/guardrail/walledai/demo.py Demo entrypoint wiring LangGraph agents + CLI.
examples/cli/guardrail/walledai/custom_agent.py Demo helper agent implementation.
examples/cli/guardrail/walledai/config.yaml Enables guardrails with type: walledai for the demo.
examples/cli/guardrail/walledai/build.sh Demo build/bootstrap script using uv.
examples/cli/guardrail/walledai/README.md Demo documentation and usage instructions.
ak-py/uv.lock Locks new dependency graph including walledai and transitive deps.
ak-py/src/agentkernel/guardrail/walledai.py Implements WalledAI guardrail hooks (safety + redaction + unmasking).
ak-py/src/agentkernel/guardrail/guardrail.py Adds factory routing for walledai input/output types.
ak-py/src/agentkernel/core/config.py Extends guardrail type validation to allow walledai.
ak-py/pyproject.toml Adds walledai optional-dependency extra.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ing/unmasking can be turned on or off as needed
@JohnPraveenYL JohnPraveenYL requested a review from amithad March 4, 2026 05:21
…led` to `pii` across documentation, configuration files, and codebase for consistency.
@JohnPraveenYL JohnPraveenYL requested a review from amithad March 4, 2026 07:41
@JohnPraveenYL JohnPraveenYL requested a review from amithad March 4, 2026 10:58
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.

4 participants