Metadata-Version: 2.4
Name: agentgate-sdk
Version: 0.1.0
Summary: The security gateway for AI agents — auth, rate limiting, and policy enforcement in one line.
License: MIT
Project-URL: Homepage, https://agent-gate-rho.vercel.app/
Project-URL: Repository, https://github.com/wiserautomation/agentgate
Project-URL: Bug Tracker, https://github.com/wiserautomation/agentgate/issues
Keywords: ai,agents,security,mcp,langchain,openai,gateway,policy
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.27.0
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.2.0; extra == "langchain"
Provides-Extra: openai
Requires-Dist: openai-agents>=0.0.3; extra == "openai"
Provides-Extra: all
Requires-Dist: langchain-core>=0.2.0; extra == "all"
Requires-Dist: openai-agents>=0.0.3; extra == "all"

# agentgate

The security gateway for AI agents.
Enforce authentication, rate limiting, and policy controls
between users and AI agents — in one line of code.

## Install

```bash
pip install agentgate
```

With LangChain:
```bash
pip install "agentgate[langchain]"
```

With OpenAI Agents SDK:
```bash
pip install "agentgate[openai]"
```

Everything:
```bash
pip install "agentgate[all]"
```

## Quickstart

Get your free API key at https://agent-gate-rho.vercel.app/

### Any agent (generic)
```python
from agentgate import with_agent_gate, AgentGateOptions

secured = with_agent_gate(my_agent, AgentGateOptions(
    api_key="ag_your_key_here"
))
result = secured.run("delete_file", {"path": "/etc/passwd"})
```

### LangChain
```python
from agentgate import AgentGateLangChainCallback, AgentGateOptions
from langchain.agents import AgentExecutor

callback = AgentGateLangChainCallback(
    AgentGateOptions(api_key="ag_your_key_here")
)
agent_executor = AgentExecutor(
    agent=agent,
    tools=tools,
    callbacks=[callback],
)
```

### OpenAI Agents SDK
```python
from agentgate import wrap_openai_agent, AgentGateOptions
from agents import Agent, Runner

secured = wrap_openai_agent(agent, AgentGateOptions(
    api_key="ag_your_key_here"
))
result = await Runner.run(secured, "Send email to all users")
```

### MCP middleware
```python
from agentgate import AgentGateMiddleware, AgentGateOptions

gate = AgentGateMiddleware(AgentGateOptions(api_key="ag_your_key_here"))

# Inline check
result = gate.check("send_email", args, lambda: send_email(args))

# As a decorator
@gate.guard()
def delete_user(user_id: str):
    ...
```

## Fail-open vs Fail-closed
```python
# Development (default)
AgentGateOptions(api_key="ag_xxx", on_network_error="fail-open")

# Production (recommended)
AgentGateOptions(api_key="ag_xxx", on_network_error="fail-closed")
```

## Policy decisions

| Decision | Behaviour |
| -------- | --------- |
| ALLOW    | Tool executes normally |
| DENY     | Tool blocked, error string returned |
| REQUIRE_APPROVAL | Tool paused, human approves in dashboard |

## Links

Dashboard: https://agent-gate-rho.vercel.app/
GitHub: https://github.com/wiserautomation/agentgate
Issues: https://github.com/wiserautomation/agentgate/issues
