Metadata-Version: 2.5
Name: decionis-autogen
Version: 0.1.0
Summary: Pre-execution Decionis policy gates for current AutoGen tools and legacy UserProxyAgent.
Project-URL: Homepage, https://decionis.com
Project-URL: Documentation, https://decionis.com/integrations/autogen
Project-URL: Repository, https://github.com/decionis/Decionis
Project-URL: Issues, https://github.com/decionis/Decionis/issues
Author-email: Decionis <sdk@decionis.ai>
License: MIT
Keywords: audit,autogen,decionis,execution-gate,governance,multi-agent,policy,tool
Classifier: Development Status :: 3 - Alpha
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: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: autogen-core<0.8,>=0.4
Requires-Dist: decionis>=0.2
Requires-Dist: pydantic>=2.7
Provides-Extra: legacy
Requires-Dist: autogen-agentchat<0.3,>=0.2.36; (python_version < '3.13') and extra == 'legacy'
Provides-Extra: lint
Requires-Dist: mypy>=1.10; extra == 'lint'
Requires-Dist: ruff>=0.5; extra == 'lint'
Provides-Extra: test
Requires-Dist: pytest>=8; extra == 'test'
Description-Content-Type: text/markdown

# `decionis-autogen`

Add a Decionis policy decision immediately before an AutoGen tool executes. The package supports
the current AutoGen Core tool interface and the legacy AutoGen 0.2 `UserProxyAgent` execution hook.

## Current AutoGen

```bash
pip install decionis-autogen
```

```python
from autogen_core.tools import FunctionTool
from decionis import DecionisClient
from decionis_autogen import guard_tool

refund_tool = FunctionTool(send_refund, description="Issue a customer refund.")
guarded_refund = guard_tool(
    inner_tool=refund_tool,
    client=DecionisClient(api_key="..."),
    tenant_id="your-org-uuid",
    workflow_key="refund_execution",
    site_base_url="https://decionis.com",
)

agent = AssistantAgent(..., tools=[guarded_refund])
```

The wrapper preserves the inner tool schema. An `ALLOW` verdict delegates to the tool. `BLOCK`,
`REVIEW_REQUIRED`, and `ESCALATE` raise `DecionisToolRefusal` before the side effect runs.

## AutoGen 0.2 `UserProxyAgent`

The requested `execute_function` interception applies to AutoGen 0.2. Install the legacy extra on
Python 3.10–3.12:

```bash
pip install 'decionis-autogen[legacy]'
```

```python
from decionis import DecionisClient
from decionis_autogen import DecionisUserProxyAgent

executor = DecionisUserProxyAgent(
    "executor",
    decionis_client=DecionisClient(api_key="..."),
    tenant_id="your-org-uuid",
    function_map={"send_refund": send_refund},
    human_input_mode="NEVER",
)
```

The subclass overrides both `execute_function` and `a_execute_function`. A blocked call returns a
structured function error with the dossier id and never invokes the registered function.

For either API, set `shadow_mode=True` to record would-block verdicts while still executing the
inner tool. Enforcement is fail closed: evaluation errors do not silently fall through to the tool.

Compatibility: Python 3.10+, AutoGen Core 0.4–0.7; legacy AutoGen AgentChat 0.2 on Python 3.10–3.12.
