Metadata-Version: 2.5
Name: langchain-openentity
Version: 0.2.0
Summary: RuthlessSchemaGuard: LangChain middleware and HTTP transport guard that raises on malformed API and tool responses, with an optional signed ledger reporter.
Project-URL: Homepage, https://openentity.org
Project-URL: Documentation, https://oeis.dev
Project-URL: Source, https://github.com/moltbot-den/openentity/tree/main/integrations/langchain
Project-URL: Issues, https://github.com/moltbot-den/openentity/issues
Author: Open Entity
License-Expression: MIT
License-File: LICENSE
Keywords: agents,langchain,middleware,openentity,schema,validation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: httpx
Requires-Dist: jsonschema>=4.18
Requires-Dist: langchain>=1.4
Requires-Dist: langgraph>=1
Requires-Dist: pydantic>=2
Provides-Extra: aiohttp
Requires-Dist: aiohttp; extra == 'aiohttp'
Provides-Extra: ledger
Requires-Dist: openentity>=0.4; extra == 'ledger'
Provides-Extra: requests
Requires-Dist: requests; extra == 'requests'
Description-Content-Type: text/markdown

# langchain-openentity

RuthlessSchemaGuard for LangChain: middleware and HTTP transport guard that raise `OpenEntitySchemaViolation` on malformed tool and API responses, a dead-loop breaker, and an optional signed ledger reporter.

```bash
pip install langchain-openentity
```

```python
import httpx
from langchain.agents import create_agent
from langchain_core.tools import tool
from langchain_openentity import RuthlessSchemaGuard
from pydantic import BaseModel

class Pull(BaseModel):
    number: int
    title: str

@tool
def get_pulls(repo: str) -> str:
    """List open pull requests of a GitHub repo."""
    return httpx.get(f"https://api.github.com/repos/{repo}/pulls", headers={"Accept": "application/json"}).text

guard = RuthlessSchemaGuard()
guard.register("get_pulls", list[Pull])
guard.guard_http()
agent = create_agent("anthropic:claude-sonnet-4-6", tools=[get_pulls], middleware=[guard])  # first in the list
```

Full documentation, the rule table and the ledger settings: <https://github.com/moltbot-den/openentity/tree/main/integrations/langchain>
