Metadata-Version: 2.4
Name: cred-openai-agents
Version: 0.1.0
Summary: Cred OpenAI Agents SDK integration — credential delegation FunctionTool
Author-email: Cred <hello@cred.ninja>
License: Apache-2.0
Keywords: agents,ai-agents,cred,delegation,oauth,openai
Requires-Python: >=3.9
Requires-Dist: cred-auth>=0.1.0
Requires-Dist: openai-agents>=0.1
Provides-Extra: dev
Requires-Dist: hatchling; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Description-Content-Type: text/markdown

# cred-openai-agents

OpenAI Agents SDK integration for Cred. OAuth2 credential delegation for AI agents.

## Install

```bash
pip install cred-openai-agents
```

## Quick Start

```python
import os
from cred_openai_agents import cred_delegate_tool
from agents import Agent

tool = cred_delegate_tool(
    agent_token=os.environ["CRED_AGENT_TOKEN"],
    user_id="user_123",
    app_client_id="my_app_client_id",
)

agent = Agent(
    name="assistant",
    tools=[tool],
)
```

## Tool Schema

The `cred_delegate` tool matches the Cred MCP tool spec:

| Parameter | Type | Description |
|-----------|------|-------------|
| `service` | `string` | Service slug (e.g. `google`, `github`) |
| `scopes` | `string[]` | OAuth scopes to request |

`user_id` and `app_client_id` are pre-configured at factory time, not agent-controlled.

## Handling Consent

When the user hasn't connected the service, the tool raises `ConsentRequiredError`.
The error's `consent_url` attribute contains the URL to redirect the user.

## Cred Cloud (Coming Soon)

Managed cloud delegation is coming. [Join the waitlist](https://cred.ninja/waitlist).
