Python SDK
Official Python SDK for the Doorway reasoning engine.
Installation
bash
pip install doorway-sdkQuick start
python
from doorway import Doorway
dw = Doorway(api_key="dw_live_...")
# Single reasoning call
result = dw.run("What makes a system antifragile?")
print(result.status) # GROUND
print(result.content.answer) # The structured answer
# Multi-turn conversation
session = dw.session("antifragility")
r1 = session.run("What makes a system antifragile?")
r2 = session.run("How does this relate to biological evolution?")
r3 = session.run("Can organizations be antifragile?")
# Chain grows with each turn
print(r3.chain.length) # 3
print(r3.chain.verified) # TrueConfiguration
python
# Environment variable (recommended)
# export DOORWAY_API_KEY="dw_live_..."
dw = Doorway()
# Explicit key
dw = Doorway(api_key="dw_live_...")
# Custom endpoint
dw = Doorway(base_url="https://custom.endpoint.com")
# ASI tier
dw = Doorway(tier="asi")Error handling
python
from doorway import Doorway, DoorwayError, TierError
dw = Doorway()
try:
result = dw.run("test input")
except TierError:
print("ASI feature requested on AGI tier")
except DoorwayError as e:
print(f"Engine error: {e}")