semvec/pypi-packages huggingface dataset:
aport-agent-guardrails-crewai 1.0.10
APort Agent Guardrail for CrewAI — before_tool_call hook for AI agent and multi-agent crews
License: Apache-2.0
Requires Python: >=3.10
Keywords: aport, agent guardrail, LLM guardrail, crewai, guardrails, multi-agent, AI agent

# APort Agent Guardrail for CrewAI

**APort Agent Guardrail for CrewAI** — pre-action authorization for [CrewAI](https://github.com/crewAIInc/crewAI) via the **before_tool_call** hook. Tool execution is verified against your passport and policy; deny → execution is blocked. Built for AI agent and multi-agent crews.

## Install

```bash
pip install aport-agent-guardrails-crewai
aport-crewai setup
```

## Usage

```python
from aport_guardrails_crewai import register_aport_guardrail

register_aport_guardrail()
crew.kickoff()
```

Or use the `with_aport_guardrail` decorator on your entry point. See [docs/frameworks/crewai.md](https://github.com/aporthq/agent-guardrails/blob/main/docs/frameworks/crewai.md).

## API

- **`aport_guardrail_before_tool_call(context)`** — Hook compatible with `@before_tool_call`; returns `False` to block, `None` to allow.
- **`register_aport_guardrail()`** — Registers the hook globally.
- **`with_aport_guardrail`** — Decorator that registers the hook then runs the wrapped function.
aport-agent-guardrails-langchain 1.0.10
APort Agent Guardrail for LangChain/LangGraph — AsyncCallbackHandler for AI agent tool calls
License: Apache-2.0
Requires Python: >=3.10
Keywords: aport, agent guardrail, LLM guardrail, langchain, langgraph, guardrails, agent, AI agent

# APort Agent Guardrail for LangChain

**APort Agent Guardrail for LangChain/LangGraph** — pre-action authorization for AI agents: an `AsyncCallbackHandler` that verifies every tool call against your passport and policies before execution. On deny, raises `GuardrailViolation`.

## Install

```bash
pip install aport-agent-guardrails-langchain
```

Requires **aport-agent-guardrails** (core); installs automatically.

## Setup

```bash
aport-langchain setup
```

- Writes config to `~/.aport/langchain/config.yaml`.
- Run the passport wizard with: `npx @aporthq/aport-agent-guardrails --framework=langchain`.

## Usage

```python
from aport_guardrails_langchain import APortCallback, GuardrailViolation

# Add callback to your agent
agent = initialize_agent(
    tools=tools,
    llm=llm,
    callbacks=[APortCallback()]
)

# On deny, the callback raises GuardrailViolation
try:
    result = await agent.ainvoke(...)
except GuardrailViolation as e:
    print(f"Blocked: {e.code} — {e}")
    print("Reasons:", e.reasons)
```

Config is auto-loaded from `.aport/config.yaml` or `~/.aport/langchain/config.yaml`. Override with `APortCallback(config_path="/path/to/config.yaml")`.

## Config

- **mode:** `local` | `api`
- **passport_path:** path to passport JSON (local mode)
- **agent_id:** `ap_xxx` (API mode, hosted passport)
- **api_url:** optional; default `https://api.aport.io`

## Tests

```bash
cd python/langchain_adapter
pip install -e ".[dev]"
pip install -e ../aport_guardrails
pytest tests/ -v
```

## Links

- [Framework doc](https://github.com/aporthq/agent-guardrails/blob/main/docs/frameworks/langchain.md)
- [APort](https://aport.io)