Metadata-Version: 2.4
Name: infragrid
Version: 0.1.0
Summary: Python SDK for ordered Infragrid browser workflows
Author-email: Infragrid <hello@infragrid.ai>
Maintainer-email: Infragrid <hello@infragrid.ai>
License-Expression: MIT
Project-URL: Documentation, https://docs.infragrid.ai/sdks/python
Project-URL: Repository, https://github.com/Infragrd-Browser/agentic-browser
Project-URL: Issues, https://github.com/Infragrd-Browser/agentic-browser/issues
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# Infragrid Python SDK

Build ordered browser workflows with the same small API as the JavaScript SDK:

```python
from infragrid import Infragrid

client = Infragrid()  # reads INFRAGRID_API_KEY
result = (
    client.workflow("account-review")
    .navigate("https://example.com")
    .type("#account-search", "%account_id%", submit=True)
    .extract("extract the account risk details", name="risk")
    .run(variables={"account_id": "acct_123"})
)
```

Install locally with `pip install -e packages/python-sdk`.

This sends native workflow JSON; it does not generate Brick or compile the steps
into a prompt. Named extractions are available in `run["result"]["outputs"]`.

## Configuration and failures

The client reads `INFRAGRID_API_KEY` and optional `INFRAGRID_BASE_URL`. Explicit
constructor arguments take precedence over environment variables. GET requests
retry transient connection, timeout, rate-limit, and server failures up to
`max_retries`; create requests retry only when an `idempotency_key` makes replay
safe, including a bounded server response while the original idempotency claim
is still completing.

HTTP failures raise status-specific `InfragridError` subclasses and preserve the
server request ID when one is available. Invalid successful JSON, malformed run
envelopes, and unexpected transport failures are surfaced as
`APIConnectionError` instances. Responses are capped at 1 MiB; oversized
successful payloads fail closed and oversized error bodies are discarded before
status-specific classification.

## Published Blueprints

```python
blueprint = client.blueprints.list()["data"][0]
run = client.blueprints.runs.create(
    blueprint["id"],
    {"account_id": "acct_123"},
    revision_id=blueprint["latestRevision"]["id"],
    idempotency_key="account-review-acct-123",
)
events = client.blueprints.runs.events(run["id"])
finished = client.blueprints.runs.wait(run["id"])
```

Omit `revision_id` to pin the latest published revision at run creation. The SDK
does not expose draft graph authoring. `blueprints.run()` remains a compatibility
alias for `blueprints.runs.create()`.
