Catalog PyPI
Back to packageRELEASE DETAILS

0.1.0

PyPI

agentshield-runtime

Runtime security guardrails for AI agents — inspect, control, and audit every tool call. Zero-dependency local mode included.

agent-safetyai-agentai-securityguardrailslangchainllm-securitymcpprompt-injectiontool-use
Published18 Apr 2026
Direct dependencies9
Transitive dependenciesNot calculated

README

Version 0.1.0 documentation

AgentShield Python SDK

Lightweight security guardrails for AI agents. All security logic runs server-side.

Quick Start

from agentshield import Shield

shield = Shield()  # reads AGENTSHIELD_API_KEY from env

@shield.guard
async def send_email(to: str, body: str) -> str:
    ...  # your tool implementation

# The server decides: ALLOW, BLOCK, or REQUIRE_CONFIRMATION
await send_email(to="user@company.com", body="Hello")

Session Mode

async with shield.session("Summarize my emails") as s:
    result = await s.guarded_executor.execute(
        "read_inbox", {"limit": 10}, read_inbox_fn
    )

Error Handling

from agentshield import Shield, ToolCallBlocked, ConfirmationRejected, ServerError

shield = Shield()

@shield.guard
async def send_email(to: str, body: str) -> str:
    ...

try:
    await send_email(to="user@test.com", body="hi")
except ToolCallBlocked as e:
    print(f"Blocked: {e.reason} (trace: {e.trace_id})")
except ConfirmationRejected:
    print("User declined confirmation")
except ServerError as e:
    print(f"Server error: {e}")

Configuration

# Explicit configuration
shield = Shield(
    api_key="your-key",
    base_url="https://shield.yourcompany.com",
    timeout=10.0,
    max_retries=3,
    agent_id="my-agent",
)

Or via environment variables:

  • AGENTSHIELD_API_KEY (required)
  • AGENTSHIELD_BASE_URL (default: http://localhost:8000)
  • AGENTSHIELD_TIMEOUT (default: 10.0)
  • AGENTSHIELD_AGENT_ID

Or via agentshield.yaml in the working directory.

Data Sanitization

# Sanitize external data before processing
result = await shield.sanitize(
    data=email_body,
    source="email/external",
)
# result.content has hidden injections removed
# result.trust_level shows the computed trust level

Framework Integrations

from agentshield.integrations import LangChainShield, CrewAIShield

# LangChain
guarded = LangChainShield(shield).wrap(agent_executor)

# CrewAI
guarded = CrewAIShield(shield).wrap(crew)

# AutoGen
from agentshield.integrations import AutoGenShield
AutoGenShield(shield).wrap(assistant)

# Claude Agent SDK
from agentshield.integrations import ClaudeAgentShield
guarded_handler = ClaudeAgentShield(shield).wrap(my_tool_handler)

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 13

Native requirements
9 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
httpx
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
httpx<1,>=0.25runtime
pyyaml
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pyyaml<7,>=6runtime
claude-agent-sdk
Environment
{
  "extras": "",
  "marker": "extra == \"all\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
claude-agent-sdk>=0.1; extra == "all"runtime
crewai
Environment
{
  "extras": "",
  "marker": "extra == \"all\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
crewai>=0.30; extra == "all"runtime
langchain-core
Environment
{
  "extras": "",
  "marker": "extra == \"all\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
langchain-core>=0.1; extra == "all"runtime
pyautogen
Environment
{
  "extras": "",
  "marker": "extra == \"all\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pyautogen>=0.2; extra == "all"runtime
pyautogen
Environment
{
  "extras": "",
  "marker": "extra == \"autogen\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pyautogen>=0.2; extra == "autogen"runtime
claude-agent-sdk
Environment
{
  "extras": "",
  "marker": "extra == \"claude\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
claude-agent-sdk>=0.1; extra == "claude"runtime
crewai
Environment
{
  "extras": "",
  "marker": "extra == \"crewai\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
crewai>=0.30; extra == "crewai"runtime
pytest-asyncio
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pytest-asyncio>=0.23; extra == "dev"runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pytest>=8; extra == "dev"runtime
respx
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
respx>=0.21; extra == "dev"runtime
langchain-core
Environment
{
  "extras": "",
  "marker": "extra == \"langchain\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
langchain-core>=0.1; extra == "langchain"runtime

Distribution files

2 collected
agentshield_runtime-0.1.0-py3-none-any.whl

bdist_wheel · 20.82 KB · Python py3

Source file
agentshield_runtime-0.1.0.tar.gz

sdist · 18.95 KB · Python source

Source file

Repository

PENDING
hidearmoon/agentshield

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 23:22 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:0b5406b4738d572ac7b799baaaccb7ebef2fddf16a40e41d37b486892e81626e

Other collected versions

View all collected versions →