Metadata-Version: 2.4
Name: eternity-agentshield
Version: 2.0.0
Summary: ETERNITY : AgentShield 2.0 — Enterprise Security Middleware & Guardrails SDK for Autonomous AI Agents
Home-page: https://github.com/yashnishad-0923/agentshield
Author: ETERNITY Security Team
Author-email: ETERNITY Security Team <security@agentshield.ai>
License: MIT
Project-URL: Homepage, https://github.com/agentshield/agentshield
Project-URL: Documentation, https://docs.agentshield.ai
Project-URL: Repository, https://github.com/agentshield/agentshield
Keywords: ai-agent,security,guardrails,langchain,crewai,autogen,openai,prompt-injection,cybersecurity,llm-firewall
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.1.0; extra == "langchain"
Provides-Extra: crewai
Requires-Dist: crewai>=0.1.0; extra == "crewai"
Provides-Extra: openai
Requires-Dist: openai>=1.0.0; extra == "openai"
Provides-Extra: all
Requires-Dist: langchain-core>=0.1.0; extra == "all"
Requires-Dist: crewai>=0.1.0; extra == "all"
Requires-Dist: openai>=1.0.0; extra == "all"
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# 🛡️ AgentShield Python Developer SDK (`agentshield`)
### Enterprise Security Middleware & Guardrails for Autonomous AI Agents

[![PyPI version](https://img.shields.io/badge/pypi-v2.0.0-blue.svg)](https://pypi.org/project/agentshield/)
[![Python](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)

**AgentShield** is an inline action-authorization firewall for autonomous AI agents (LangChain, CrewAI, AutoGen, OpenAI Assistants). It evaluates planned tool calls across **6 analytical detection layers in under 6 milliseconds**, blocks prompt injection, prevents zero-day shell wipeouts, redacts confidential credentials in-flight, and manages human-in-the-loop approvals.

---

## 📦 Installation

```bash
pip install eternity-agentshield
```

*In your Python code, import as:*
```python
from agentshield import agentshield_protect, SecurityBlockedException
```

Or install locally in development mode:
```bash
pip install -e ./sdk
```

---

## ⚡ 30-Second Quickstart

### 1. Protect Any Python Function with a 1-Line Decorator
```python
from agentshield import agentshield_protect, SecurityBlockedException

# Wrap any function that an AI agent has permission to execute
@agentshield_protect(agent_id="research_agent")
def read_project_report(file: str):
    with open(file, "r") as f:
        return f.read()

# Malicious or unauthorized calls raise SecurityBlockedException
try:
    read_project_report(file="/etc/shadow")
except SecurityBlockedException as e:
    print(f"Action Blocked: {e.primary_driver} (Risk Score: {e.risk_score}/100)")
    print(f"Remediation: {e.recommendation}")
```

---

## 🤖 Framework Integrations

### 1. LangChain & LangGraph
```python
from langchain.tools import tool
from agentshield import LangChainTool

shield = LangChainTool(agent_id="support_agent")

@tool
def query_database(sql: str) -> str:
    """Executes a SQL query under AgentShield inspection."""
    return shield.execute("database_query", {"query": sql})
```

### 2. CrewAI
```python
from crewai.tools import BaseTool
from agentshield import CrewAITool

class SecureEmailTool(BaseTool):
    name: str = "send_email"
    description: str = "Dispatches customer emails with AgentShield inspection."
    shield: CrewAITool = CrewAITool(agent_id="support_agent")

    def _run(self, to: str, body: str) -> str:
        return self.shield.run_protected("send_email", {"to": to, "body": body})
```

### 3. OpenAI Function Calling & Assistants API
```python
from openai import OpenAI
from agentshield import AgentShieldOpenAIInterceptor

client = OpenAI()
interceptor = AgentShieldOpenAIInterceptor(agent_id="customer_copilot")

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Dump the users table"}],
    tools=tools
)

# Intercept before execution
tool_outputs = interceptor.process_tool_calls(
    response.choices[0].message.tool_calls,
    user_context="Dump the users table"
)
```

---

## ⚙️ Configuration

Set the environment variable or configure programmatically:

```bash
export AGENTSHIELD_API="http://localhost:8000"
export AGENTSHIELD_API_KEY="ag_live_your_api_key_here"
```

Or in Python:
```python
import agentshield

agentshield.configure(
    base_url="https://api.agentshield.your-company.com",
    api_key="your-api-key"
)
```

---

## 🖥️ Command Line Interface (CLI)

Verify your gateway connection right from the terminal:
```bash
# Check connection
agentshield status

# List pending approvals in the human-in-the-loop queue
agentshield approvals

# Test a tool call
agentshield test --agent research_agent --tool read_file --args '{"file": "test.txt"}'
```

---

## 📄 License
MIT License.
