Metadata-Version: 2.4
Name: getstack
Version: 0.2.0
Summary: Python SDK for STACK — trust infrastructure for AI agents
Project-URL: Homepage, https://getstack.run
Project-URL: Documentation, https://getstack.run/docs/sdk
Project-URL: Repository, https://github.com/getstack-run/sdk-python
Author-email: STACK <hello@getstack.run>
License-Expression: MIT
License-File: LICENSE
Keywords: agents,ai,mcp,passport,stack,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.25.0
Description-Content-Type: text/markdown

# getstack

Python SDK for [STACK](https://getstack.run) — trust infrastructure for AI agents.

## Install

```bash
pip install getstack
```

## Quick start

```python
from getstack import Stack

stack = Stack(api_key="sk_live_...")

# Register an agent
agent = stack.agents.register("my-agent", accountability_mode="enforced")

# Run a mission with automatic checkpoints and checkout
with stack.passports.mission(
    agent_id=agent.id,
    intent="Process invoices from Slack",
    services=["slack", "stripe"],
    checkpoint_interval="5m",
) as mission:
    mission.log("slack", "read_channel", "#invoices")
    mission.log("stripe", "create_invoice")
    # Checkpoints are submitted automatically on schedule
# Checkout is submitted automatically when the block exits
```

## Authentication

```python
# API key (most common)
stack = Stack(api_key="sk_live_...")

# OAuth with auto-refresh
stack = Stack.from_oauth(
    client_id="...",
    client_secret="...",
    access_token="...",
    refresh_token="...",
)

# Session JWT (dashboard integrations)
stack = Stack.from_session(session_token="...")
```

## Continuous missions (24/7 agents)

```python
for mission in stack.passports.continuous_mission(
    agent_id=agent.id,
    intent="Monitor Slack channels",
    services=["slack"],
    rotation_interval="4h",
    checkpoint_interval="5m",
):
    while not mission.should_rotate:
        event = wait_for_event()
        mission.log("slack", "read_message")
        process(event)
    # Passport rotates automatically at the boundary
```

## Services

```python
# Agents
stack.agents.register(name, description=None, accountability_mode="enforced")
stack.agents.get(agent_id)
stack.agents.list()
stack.agents.update(agent_id, **fields)
stack.agents.unblock(agent_id)

# Passports
stack.passports.issue(agent_id, intent=None, services=None, ...)
stack.passports.verify(token)
stack.passports.revoke(jti, reason=None)
stack.passports.checkpoint(jti, services_used, actions_count, ...)
stack.passports.checkout(jti, services_used, actions_count, ...)
stack.passports.report(jti)

# Credentials
stack.credentials.get(provider)
stack.credentials.get_by_connection(connection_id)

# Services
stack.services.list()
stack.services.connect_custom(name, credential, ...)
stack.services.verify(connection_id)
stack.services.disconnect(connection_id)

# Reviews
stack.reviews.list(status="flagged")
stack.reviews.decide(checkout_id, decision, notes=None, block_future=False)

# Drop-offs
stack.dropoffs.create(from_agent_id, to_agent_id, schema, ...)
stack.dropoffs.deposit(dropoff_id, data, agent_id)
stack.dropoffs.collect(dropoff_id, agent_id)

# Notifications
stack.notifications.list()
stack.notifications.create(channel_type, destination, ...)
stack.notifications.delete(channel_id)

# Audit
stack.audit.list(page=1, limit=50, action=None, agent_id=None)
```

## Links

- [Documentation](https://getstack.run/docs/sdk)
- [Dashboard](https://getstack.run)
- [GitHub](https://github.com/getstack-run/sdk-python)
