Catalog PyPI
PACKAGE EXPLORERView in registry

agentshield-runtime

PyPI

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
Versions collected1
Direct dependencies9From release 0.1.0
Last observed20 Oct, 23:22 UTC

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.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.018 Apr 20269

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

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:f01112b4c9d08aa3001adbd7837e867d8e9ada816aae60d6a538a04f8ab9222b