Catalog PyPI
Back to packageRELEASE DETAILS

0.1.0

PyPI

agentwall-sdk

A lightweight safety, approval, audit, replay, and rollback layer for AI agent tools

agentsaiguardrailsmiddlewaretool-use
Published7 Sept 2026
Direct dependencies6
Transitive dependenciesNot calculated

README

Version 0.1.0 documentation

agentwall

Safety middleware for AI agent tool calls, available for Python and TypeScript.

Agents routinely execute shell commands, write files, mutate databases, and call authenticated APIs. Most tool-use stacks pass those calls directly to application code. agentwall adds a small interception layer that classifies each call, requests approval when required, emits a structured event, and registers an optional rollback.

from agentwall import Agentwall, BlockedError
wall = Agentwall()
@wall.tool("bash")
def bash(command: str) -> str:
    return f"executed: {command}"
try:
    bash("rm -rf /tmp/build-cache")
except BlockedError:
    print("blocked")
# The destructive call runs only after terminal approval.

Install

Python 3.9+:

pip install agentwall-sdk

Node.js 18+:

npm install agentwall-sdk

The core packages have no runtime dependencies. Framework clients are optional.

Demo

Terminal demo showing a destructive tool call being blocked

Quickstart

Python

Decorate an existing tool, or execute a ToolSpec inside a rollback-capable session:

from pathlib import Path
from agentwall import Agentwall, ToolSpec

wall = Agentwall()  # loads ./agentwall.yaml

def write_file(path: str, content: str) -> str:
    Path(path).write_text(content)
    return path

def remove_file(path: str, content: str) -> None:
    Path(path).unlink(missing_ok=True)

with wall.session(agent_id="worker-1") as session:
    session.call(
        ToolSpec("write_file", write_file, remove_file),
        path="result.txt",
        content="done",
    )

If the session exits with an exception, successful calls with rollback functions are compensated in reverse order. Normal exit commits the session.

Adapters accept the native OpenAI, Anthropic, and LangChain tool-call shapes:

from agentwall.integrations import (
    execute_anthropic_tool_use,
    execute_openai_tool_call,
    wrap_langchain_tool,
)

result = execute_openai_tool_call(tool_call, tools_by_name, wall)
result = execute_anthropic_tool_use(tool_use, tools_by_name, wall)
guarded_tool = wrap_langchain_tool(langchain_tool, wall)

TypeScript

import { Agentwall } from "agentwall-sdk";

const wall = new Agentwall();
const guarded = wall.wrap("bash", async ({ command }) => {
  return runCommand(String(command));
});

await guarded({ command: "rm -rf /tmp/build-cache" });

executeOpenAIToolCall, executeAnthropicToolUse, and wrapLangChainTool are exported from the TypeScript package.

Classification and approval

Each call is classified as:

LevelTypical actionsDefault behavior
safereads, searches, read-only SQLexecute
cautiousfile writes, unauthenticated mutationsexecute and log
destructivedestructive SQL or shell commands, authenticated mutationsrequire approval

Terminal approval is fail-closed. WebhookApproval posts the tool name, arguments, and classification to an HTTP endpoint and accepts only a successful response containing {"approved": true}.

Configuration

agentwall reads one agentwall.yaml from the working directory. Set AGENTWALL_CONFIG to use another YAML or JSON file.

approval:
  levels: ["destructive"]
logging:
  sink: file
  path: .agentwall/events.jsonl
webhook:
  url: null
  timeout_seconds: 30
default_classification: safe
redact_keys: ["authorization", "api_key", "token", "password", "secret"]
rules:
  - name: destructive-shell
    classification: destructive
    tool_pattern: "(?i)^(bash|shell|terminal)$"
    argument_pattern: "(?i)(rm\\s+-rf|mkfs|shutdown)"
  - name: file-writes
    classification: cautious
    tool_pattern: "(?i)(write|save|patch)_file"

Rules are evaluated in order; the first complete match wins.

KeyTypeDefaultDescription
approval.levelslist["destructive"]Classifications requiring approval
logging.sinkfile or stdoutfileBuilt-in event destination
logging.pathstring.agentwall/events.jsonlJSONL path for the file sink
webhook.urlstring or nullnullSynchronous approval endpoint
webhook.timeout_secondsnumber30Approval request timeout
default_classificationclassificationsafeResult when no rule or built-in matches
redact_keyslistcommon credential keysKeys recursively redacted from logs
rules[].namestringrequiredStable rule name
rules[].classificationclassificationrequiredResult for a matching rule
rules[].tool_patternregex.*Tool-name matcher
rules[].argument_patternregexunsetMatcher applied to serialized arguments
rules[].methodslist[]Optional HTTP method matcher

Environment overrides:

VariablePurpose
AGENTWALL_CONFIGConfig file path
AGENTWALL_APPROVAL_LEVELSComma-separated approval levels
AGENTWALL_DEFAULT_CLASSIFICATIONDefault classification
AGENTWALL_LOG_SINKfile or stdout
AGENTWALL_LOG_PATHJSONL output path
AGENTWALL_WEBHOOK_URLApproval endpoint
AGENTWALL_WEBHOOK_TIMEOUT_SECONDSApproval timeout
AGENTWALL_REDACT_KEYSComma-separated keys to redact

The dependency-free YAML reader supports mappings, nested mappings, scalar lists, and lists of mappings. It does not support anchors, tags, or multiline scalars.

Replay

Dry-run approved, successful calls in log order:

agentwall replay .agentwall/events.jsonl

Execution replay requires an explicit ReplayRegistry containing sandbox-safe implementations:

agentwall replay .agentwall/events.jsonl --execute --module sandbox_tools

Development

See CONTRIBUTING.md.

License

Apache-2.0

Downloads & popularity

Awaiting observations

No metric observations yet

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

Declared dependencies 6

Native requirements
6 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
anthropic
Environment
{
  "extras": "",
  "marker": "extra == \"anthropic\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
anthropic>=0.30; extra == "anthropic"runtime
openai
Environment
{
  "extras": "",
  "marker": "extra == \"openai\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
openai>=1.30; extra == "openai"runtime
langchain-core
Environment
{
  "extras": "",
  "marker": "extra == \"langchain\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
langchain-core>=0.2; extra == "langchain"runtime
build
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
build>=1.2; extra == "dev"runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
pytest>=8; extra == "dev"runtime
pytest-asyncio
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
pytest-asyncio>=0.23; extra == "dev"runtime

Distribution files

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

bdist_wheel · 16.77 KB · Python py3

Source file
agentwall_sdk-0.1.0.tar.gz

sdist · 15.69 KB · Python source

Source file

Repository

PENDING
anakatt/agentwall

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 08:55 UTC

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

Record identity

package_version:d4dd4296bb403a05c09ef45be02d26dc2def77a7ac3f9db4bfa05bb2a280c516

Other collected versions

View all collected versions →