Metadata-Version: 2.4
Name: revive-sdk
Version: 0.1.0
Summary: Agent recovery control plane SDK: protect agent actions so a failed credential parks the run and resumes exactly-once, without duplicating side effects. LangGraph, OpenAI Agents, and Anthropic tool-use adapters included.
Project-URL: Homepage, https://revivelabs.app
Project-URL: Repository, https://github.com/FlyingPotato437/revive
Project-URL: Issues, https://github.com/FlyingPotato437/revive/issues
Author: Revive Labs
License: Apache-2.0
Keywords: agents,ai-agents,durable-execution,langgraph,mcp,oauth,temporal,token-refresh
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: langgraph>=0.2; extra == 'dev'
Provides-Extra: hosted
Requires-Dist: psycopg[binary]>=3.2; extra == 'hosted'
Requires-Dist: temporalio>=1.7; extra == 'hosted'
Provides-Extra: langgraph
Requires-Dist: langgraph-checkpoint-sqlite<4,>=3.1; extra == 'langgraph'
Requires-Dist: langgraph<2,>=1.2; extra == 'langgraph'
Provides-Extra: postgres
Requires-Dist: psycopg[binary]>=3.2; extra == 'postgres'
Provides-Extra: temporal
Requires-Dist: temporalio>=1.7; extra == 'temporal'
Description-Content-Type: text/markdown

# revive-sdk

Agent recovery control plane SDK for Python. Wrap an agent's real-world action
so that when its credential fails, the run parks, the right account owner
reconnects, and the run resumes — without ever duplicating a side effect that
already committed.

```bash
pip install revive-sdk
```

## Protect one action

```python
from revive import ReviveClient, ReviveParkedError

revive = ReviveClient("https://revivelabs.app", api_key="rv_live_…")

try:
    result = revive.protect_action(
        run_id=run_id,
        connection_id="conn_microsoft_ops",
        action_key="send_followup_email",
        execute=lambda: graph_send_mail(message),   # your real side effect
    )
    # executed exactly once; a retry returns the stored result, never re-sends
except ReviveParkedError as parked:
    # the credential is dead — send parked.parked.recovery_url to the account owner
    notify(parked.parked.recovery_url)
```

`protect_action` registers the action, gates execution on the ledger verdict
(`safe_to_execute` / `already_committed` / `reconcile_first`), records the
attempt, and opens a recovery case when the credential is rejected. Idempotency
keys are derived from `run_id + action_key` unless you pass `idem_key`.

## Framework adapters

```python
# OpenAI Agents SDK — protect a function tool
from revive.adapters.openai_agents import revive_tool

@revive_tool(revive, connection_id="conn_microsoft_ops")
def send_followup_email(run_id: str, to: str, subject: str) -> dict:
    ...

# Anthropic tool use — guard the tool-execution side of the loop
from revive.adapters.anthropic_tools import ReviveToolGuard
guard = ReviveToolGuard(revive, connection_id="conn_microsoft_ops",
                        protected={"send_email", "create_ticket"})

# LangGraph — see revive.adapters.langgraph (install with: pip install "revive-sdk[langgraph]")
```

## What Revive is not

Revive does not take custody of provider tokens — that stays with your
credential vault (Nango, Auth0, Entra). It coordinates the in-flight run
around a credential change: park, verify identity, fence stale workers,
reconcile, resume.

## Self-hosting (optional)

The package also ships the local park/resume engine (`Engine`,
`CheckpointStore`, `PostgresCheckpointStore`) for running the recovery loop
in-process instead of against the hosted control plane. See the repository.

Extras: `revive-sdk[langgraph]`, `revive-sdk[temporal]`, `revive-sdk[postgres]`.

License: Apache-2.0 · https://revivelabs.app
