> ## Documentation Index
> Fetch the complete documentation index at: https://docs.infragrid.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Python SDK

> Use the dependency-light Python client for synchronous browser automation.

The `infragrid` package provides a synchronous client and ordered workflow builder for Python 3.10 or newer.

<Note>
  Version 0.1.0 is implemented in the source workspace but is not yet represented as published to PyPI.
</Note>

## Install

<Tabs>
  <Tab title="Source checkout">
    ```bash theme={null}
    python -m pip install -e /absolute/path/to/agentic-browser/packages/python-sdk
    ```
  </Tab>

  <Tab title="After PyPI release">
    ```bash theme={null}
    python -m pip install infragrid
    ```
  </Tab>
</Tabs>

## Create a client

```python theme={null}
from infragrid import Infragrid

client = Infragrid()  # reads INFRAGRID_API_KEY
```

Constructor arguments:

| Argument      | Default                                | Purpose                                 |
| ------------- | -------------------------------------- | --------------------------------------- |
| `api_key`     | `INFRAGRID_API_KEY`                    | Workspace server credential             |
| `base_url`    | `INFRAGRID_BASE_URL` or production API | Explicit preview or self-hosted URL     |
| `max_retries` | 2                                      | Retries for safe or idempotent requests |
| `transport`   | Standard-library HTTP transport        | Custom request transport                |

## Browser runs

```python theme={null}
created = client.runs.create(
    task="Open example.com and summarize it.",
    metadata={"jobId": "job_123"},
    idempotency_key="job-123-v1",
)

finished = client.runs.wait(
    created["id"],
    poll_interval=2.0,
    timeout=900.0,
    on_update=lambda run: print(run["status"], run["step_count"]),
)
```

| Method                          | Purpose                            |
| ------------------------------- | ---------------------------------- |
| `runs.create(...)`              | Start exactly one task or workflow |
| `runs.get(run_id)`              | Retrieve a run                     |
| `runs.list(limit=25, offset=0)` | List bounded run history           |
| `runs.wait(run_id, ...)`        | Poll to a terminal state           |
| `runs.cancel(run_id)`           | Cancel active work                 |

## Ordered workflows

```python theme={null}
finished = (
    client.workflow("pricing-review")
    .navigate("https://example.com")
    .extract("Return the page heading", name="heading")
    .run()
)
```

Python uses snake\_case method names such as `create_tab` and keyword arguments such as `click_count`. See [Ordered workflows](/guides/ordered-workflows).

## Published Blueprints

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

The Blueprint runs client also supports `get`, `list`, `events`, and `cancel`.

## Errors

All error classes derive from `InfragridError` and expose `status`, `body`, and `request_id`. Invalid JSON, malformed successful envelopes, timeouts, and unexpected transport failures fail closed as connection errors.


## Related topics

- [Infragrid overview](/overview.md)
- [Versioning](/production/versioning.md)
- [Quickstart](/get-started/quickstart.md)
- [Changelog](/changelog.md)
- [TypeScript SDK](/sdks/typescript.md)
