Skip to content

About

Native Python SDK for AgentShield: Zero-leak secret defense, environment isolation, and kernel sandbox for LangGraph, CrewAI, AutoGen, and Smolagents.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

22 Commits

Folders and files

Repository files navigation

AgentShield Python SDK 🛡️

PyPI version Python 3.10+ License: MIT Interactive Playground Trust Center

Enterprise-grade Zero-Leak Secret Defense & Sandbox for Autonomous AI Agents built with LangGraph, CrewAI, AutoGen, LlamaIndex, and Smolagents.

Documentation • Web Portal • Trust Center • Issues


⚡ Key Features

  • @shield.protect Decorator: Zero-boilerplate function and tool protection. Automatically intercepts arguments and return values.
  • Framework Integrations:
    • LangChain & LangGraph: AgentShieldCallbackHandler
    • CrewAI: AgentShieldCrewHook
    • LlamaIndex: AgentShieldLlamaHandler
    • Microsoft AutoGen: AgentShieldAutoGenGuard
  • Zero-Leak Redaction: 40+ credential types (OpenAI, Anthropic, AWS, GitHub, Stripe, Slack, private keys, /proc/self/environ).
  • Environment Sanitization: sanitize_env() replaces sensitive variables with virtual mock tokens.
  • HMAC-SHA256 Audit Ledger: Cryptographically seals every inspection with microsecond overhead.

📦 Installation

pip install agentshield-defense

Note: In code, import as standard import agentshield or from agentshield import shield.


🚀 Usage Guide

1. The @shield.protect Decorator

Decorate any agent tool, custom function, or LLM wrapper:

from agentshield import shield

@shield.protect
def deploy_infrastructure(target: str, config: str) -> str:
    # Any incoming AWS keys or OpenAI keys in config are automatically masked
    return f"Deployed {target} with token: AKIAIOSFODNN7EXAMPLE"

# When executed:
output = deploy_infrastructure("prod-cluster", "key=sk-1234567890abcdef1234567890abcdef")
print(output)
# -> "Deployed prod-cluster with token: [AGENTSHIELD_REDACTED:AWS_ACCESS_KEY:a1b2c3d4e5f6]"

For strict enforcement (raising PermissionError on leak):

from agentshield import protect

@protect(strict=True)
def sensitive_operation():
    ...

2. LangGraph & LangChain Integration

from langchain_openai import ChatOpenAI
from agentshield import AgentShieldCallbackHandler

shield_handler = AgentShieldCallbackHandler()

llm = ChatOpenAI(
    model="gpt-4o",
    callbacks=[shield_handler]
)
# Outgoing prompts and tool invocations are inspected and sanitized in real time

3. CrewAI Guardrail Hook

from crewai import Task
from agentshield import AgentShieldCrewHook

hook = AgentShieldCrewHook()

task = Task(
    description="Analyze server environment and deploy database",
    expected_output="Deployment summary"
)

hook.before_task_execution(task)

4. LlamaIndex Callback Handler

from llama_index.core import Settings
from agentshield import AgentShieldLlamaHandler

Settings.callback_manager.add_handler(AgentShieldLlamaHandler())

5. Microsoft AutoGen Message Guard

from agentshield import AgentShieldAutoGenGuard

guard = AgentShieldAutoGenGuard()
clean_message = guard.filter_message(incoming_message)

🔒 Security & Compliance

  • Zero Cloud Exfiltration: Runs 100% locally with AGENTSHIELD_AIR_GAPPED=1.
  • Pre-filled SIG Lite / CAIQ: Download the Vendor Risk Assessment Packet at ritualdev.in/trust.
  • Statutory Alignment: Designed for India DPDP Act 2023, EU GDPR, and SOC 2 Type II.

📄 License

MIT © RitualDev Studio

About

Native Python SDK for AgentShield: Zero-leak secret defense, environment isolation, and kernel sandbox for LangGraph, CrewAI, AutoGen, and Smolagents.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages