Metadata-Version: 2.5
Name: datagusto-sdk
Version: 1.0.1
Summary: Datagusto safety middleware for LangChain agents (create_agent) and DeepAgents (create_deep_agent)
Project-URL: Homepage, https://datagusto.ai
Author-email: Datagusto <info@datagusto.jp>
License: MIT
License-File: LICENSE
Keywords: agent,datagusto,deepagents,guardrail,langchain,langgraph,safety
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.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: langchain-core<2.0,>=1.4
Requires-Dist: langchain<2.0,>=1.3
Requires-Dist: langgraph<2.0,>=1.2
Provides-Extra: deepagents
Requires-Dist: deepagents>=0.3.0; extra == 'deepagents'
Provides-Extra: dev
Requires-Dist: mypy>=1.8; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Description-Content-Type: text/markdown

# Datagusto SDK for LangChain / LangGraph / DeepAgents

`datagusto-sdk` connects agents built with LangChain's `create_agent` or
DeepAgents' `create_deep_agent` to [Datagusto](https://datagusto.ai).

## Requirements

- Python 3.10 or later
- `langchain` 1.3+, `langchain-core` 1.4+, `langgraph` 1.2+
- `deepagents` 0.3+ if you use `create_deep_agent`
- A Datagusto server URL and an agent API key

## Installation

```sh
pip install datagusto-sdk
```

## Usage

Add `DatagustoSafetyMiddleware` to your agent's middleware.

### With `create_agent`

```python
from langchain.agents import create_agent
from langgraph.checkpoint.memory import InMemorySaver
from datagusto_langgraph import DatagustoSafetyMiddleware

agent = create_agent(
    model=model,
    tools=tools,
    middleware=[
        DatagustoSafetyMiddleware(
            server_url="https://your-datagusto-server.example.com",
            api_key="your-api-key",
        )
    ],
    checkpointer=InMemorySaver(),
)

agent.invoke(
    {"messages": [{"role": "user", "content": "Summarize today's tickets."}]},
    config={"configurable": {"thread_id": "thread-1"}},
)
```

### With `create_deep_agent`

```python
from deepagents import create_deep_agent
from datagusto_langgraph import DatagustoSafetyMiddleware

agent = create_deep_agent(
    tools=tools,
    system_prompt="You are a careful research assistant.",
    middleware=[
        DatagustoSafetyMiddleware(
            server_url="https://your-datagusto-server.example.com",
            api_key="your-api-key",
        )
    ],
)
```

Use the same `thread_id` for every turn of a conversation.

## Configuration

Instead of passing `server_url` and `api_key`, you can set environment variables:

```sh
export DATAGUSTO_SAFETY_SERVER_URL="https://your-datagusto-server.example.com"
export DATAGUSTO_SAFETY_API_KEY="your-api-key"
```

```python
DatagustoSafetyMiddleware()
```

## License

MIT — see the `LICENSE` file.
