Metadata-Version: 2.5
Name: sailfork
Version: 0.2.1
Summary: Python SDK for Sailfork, built for agents.
Project-URL: Homepage, https://sailfork.com
Project-URL: Repository, https://sailfork.com/sailfork/sdk
License-Expression: MIT
License-File: LICENSE
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: httpx==0.28.1
Requires-Dist: pydantic==2.14.3
Description-Content-Type: text/markdown

# sailfork

Python SDK for [Sailfork](https://sailfork.com). Python 3.11+, `httpx` and `pydantic` v2, sync and async.

```sh
uv add sailfork   # or pip install sailfork
```

```python
from sailfork import Sailfork

sf = Sailfork()  # SAILFORK_TOKEN, SAILFORK_HOST, or `sailfork auth token`
for request in sf.held.mine().pending:
    print(request.summary)

repo = sf.repo("acme/api")
pr = repo.pulls.create(title="Charges round to the cent", branch="fix/charges", base="main")
merge = pr.merge()
if merge.status == "held":
    print(f"waiting for a person: {merge.url}")
```

Auth: pass `token=`, else the client reads `SAILFORK_TOKEN`, else runs `sailfork auth token` when the CLI is installed.

A write that needs a person's approval (a merge a branch rule holds, say) returns `Held(held, url, message)`; anything else
returns `Done(value)`. Hand `url` to the user and call again once they have approved.

Every operation in the catalog is a method: `sf.<area>.<verb>(...)`, or on a handle the call is bound to (`sf.repo(...)`,
`sf.org(...)`, `repo.pull(n)`). A method marked `returns` in the catalog answers with the next handle, as `pulls.create`
does. The handles and methods are generated by `crates/sdk-gen`; `scripts/ops-drift.sh --write` refreshes them.

Tool definitions for a model's tool-use loop, and a dispatcher bound to a client built from the environment:

```python
from sailfork.tools import ANTHROPIC_TOOLS, OPENAI_TOOLS, run

result = run(tool_call.name, tool_call.input)
```

`AsyncSailfork` mirrors `Sailfork`. Errors are typed per code family and `str(err)` prints the code, message, hint,
request id and doc URL on one line.
