Metadata-Version: 2.4
Name: agentgraph-bridge-autogen
Version: 0.1.0
Summary: AgentGraph bridge for Microsoft AutoGen — trust-gated tools and agent registration for the AgentGraph trust network
Project-URL: Homepage, https://agentgraph.co
Project-URL: Documentation, https://agentgraph.co/docs/bridges/autogen
Project-URL: Repository, https://github.com/agentgraph-co/agentgraph
Author-email: AgentGraph <sdk@agentgraph.co>
License-Expression: MIT
Keywords: agentgraph,agents,autogen,bridge,trust
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.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Requires-Dist: httpx>=0.24.0
Provides-Extra: autogen
Requires-Dist: autogen-agentchat>=0.2.0; extra == 'autogen'
Provides-Extra: dev
Requires-Dist: autogen-agentchat>=0.2.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Description-Content-Type: text/markdown

# agentgraph-bridge-autogen

> Trust-gated AutoGen tools for the AgentGraph trust network

**Status:** Early Development — [feedback welcome](https://github.com/agentgraph-co/agentgraph/issues)

## Install

```bash
pip install agentgraph-bridge-autogen

# With AutoGen support:
pip install agentgraph-bridge-autogen[autogen]
```

## Trust-Gated Tools

Wrap any function with an AgentGraph trust check before registering it with AutoGen. The wrapper will verify the trust score of the underlying repo/package before every execution.

```python
from agentgraph_bridge_autogen import trust_gated_tool

def search(query: str) -> str:
    """Search the web for information."""
    return f"Results for {query}"

# Wrap with trust gate
safe_search = trust_gated_tool(search, "owner/repo")

# Register with AutoGen
from autogen import register_function
register_function(
    safe_search,
    caller=assistant,
    executor=user_proxy,
    description="Search the web",
)
```

### Decorator syntax

```python
from agentgraph_bridge_autogen import trust_gated_function

@trust_gated_function("owner/repo", min_tier="trusted")
def calculator(expression: str) -> str:
    """Evaluate a math expression."""
    return str(eval(expression))

# Register directly with AutoGen
register_function(
    calculator,
    caller=assistant,
    executor=user_proxy,
    description="Evaluate math expressions",
)
```

### Custom trust thresholds

```python
from agentgraph_bridge_autogen import TrustGuard, trust_gated_tool

guard = TrustGuard(min_tier="trusted")  # stricter than "standard"
safe_tool = trust_gated_tool(my_func, "owner/repo", guard=guard)
```

### Quick trust check (no tool wrapping)

```python
from agentgraph_bridge_autogen import check_trust

result = await check_trust("microsoft/autogen")
print(f"{result.grade} ({result.score}/100) -- {result.reason}")
if result.allowed:
    # proceed
    ...
```

### Full AutoGen example

```python
from autogen import AssistantAgent, UserProxyAgent, register_function
from agentgraph_bridge_autogen import trust_gated_tool, TrustGuard

# Create agents
assistant = AssistantAgent(
    name="assistant",
    llm_config={"model": "gpt-4"},
)
user_proxy = UserProxyAgent(
    name="user_proxy",
    human_input_mode="NEVER",
)

# Define and gate tools
def web_search(query: str) -> str:
    """Search the web."""
    return f"Results for {query}"

guard = TrustGuard(min_tier="standard")
safe_search = trust_gated_tool(web_search, "owner/search-lib", guard=guard)

# Register the trust-gated tool
register_function(
    safe_search,
    caller=assistant,
    executor=user_proxy,
    description="Search the web (trust-verified)",
)

# Start conversation -- tools will be trust-checked before execution
user_proxy.initiate_chat(assistant, message="Search for AI agent frameworks")
```

## What This Does

This bridge provides trust-gated execution for AutoGen tool functions. It wraps callable functions so they check AgentGraph trust scores before running. If a tool's repo falls below your minimum trust tier, execution is blocked with a clear error message.

Works with AutoGen's `register_function` pattern -- wrap your functions before registration and trust checks happen transparently on every call.

## Trust Tiers

From most to least trusted: `verified` > `trusted` > `standard` > `minimal` > `restricted` > `blocked`

Set `min_tier` to control the minimum acceptable level. Default is `"standard"`.

## Documentation

Full docs at [agentgraph.co/docs](https://agentgraph.co/docs)

## Contributing

This package is in early development. We welcome issues, feedback, and PRs.
