Python SDK
Official Python SDK for Anakin (anakin.io)
Official Python SDK for the Anakin API. Wraps every documented endpoint with a single sync call, typed Pydantic v2 response models, and built-in polling.
| Status | Alpha (v0.1.x) |
| Language | Python 3.10+ |
| Package | anakin-sdk on PyPI |
| Import name | anakin (so you pip install anakin-sdk but from anakin import Anakin) |
| Source | github.com/Anakin-Inc/anakin-py |
| License | Apache 2.0 |
Install
pip install anakin-sdkQuickstart
from anakin import Anakin
client = Anakin(api_key="ak-...") # or set ANAKIN_API_KEY env var
# Scrape a single URL — returns the final result, no polling required
doc = client.scrape("https://example.com", formats=["markdown"])
print(doc.markdown)
# Discover URLs on a site
sitemap = client.map("https://example.com", limit=200)
print(sitemap.links)
# Crawl pages and get content for each
crawl = client.crawl("https://example.com", max_pages=20)
for page in crawl.pages:
print(page.url, len(page.markdown or ""))What's in v0.1
| Method | Returns |
|---|---|
client.scrape(url, ...) | Document |
client.map(url, ...) | MapResult |
client.crawl(url, ...) | CrawlResult |
client.search(prompt, ...) | SearchResult (synchronous API) |
client.agentic_search(prompt, ...) | AgenticSearchResult |
client.wire(action_id, params, ...) | WireResult (run a Wire action) |
client.sessions.list / .create / .save / .update / .delete | Browser session CRUD |
client.countries() | list[Country] (static, bundled with the SDK) |
Configuration
client = Anakin(
api_key="ak-...", # or ANAKIN_API_KEY env var
timeout=60.0, # per-request HTTP timeout (seconds)
max_retries=4, # retries on 429 / 5xx
poll_interval=1.0, # initial polling delay
poll_max_interval=10.0, # cap on exponential backoff
poll_timeout=300.0, # total wait before JobTimeoutError
)Errors
from anakin import (
AnakinError, # base for everything below
AuthenticationError, # bad/missing API key
InsufficientCreditsError, # 402 — exposes .balance, .required
InvalidRequestError, # 400
JobFailedError, # job came back with status="failed"
JobTimeoutError, # poll_timeout exceeded
RateLimitError, # 429 — exposes .retry_after
ServerError, # 5xx after retries
NetworkError, # DNS / connection / timeout
WireAuthRequiredError, # Wire action needs account connection (.connect_url)
)Examples
The examples/ folder in the repo has copy-paste-able scripts for the common workflows:
quickstart.py— scrape, map, crawl, search, wire — five recipes in one fileagentic_extraction.py— multi-stage AI search with a custom JSON schema
Stability
v0.1.x is alpha. The public API may change between minor versions until v1.0. Pin a specific version in production:
anakin==0.1.0Raise issues on GitHub.