olbrain-python-sdk 0.5.0__py3-none-any.whl → 0.5.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
olbrain/AGENTS.md CHANGED
@@ -56,7 +56,8 @@ with AgentClient(agent_id="your-agent-id", api_key=os.environ["OLBRAIN_API_KEY"]
56
56
  - `agent_id`: required. An empty value raises `ValueError`.
57
57
  - `api_key`: must start with `ak_`, `sk_live_`, `org_live_`, `sk_` or `org_`,
58
58
  or the constructor raises `ValueError`.
59
- - `agent_url`: optional. Defaults to `https://webhook.olbrain.com`.
59
+ - `agent_url`: optional. Defaults to the `OLBRAIN_AGENT_URL` environment
60
+ variable if set, otherwise `https://webhook.olbrain.com`.
60
61
 
61
62
  Chat calls are `POST {agent_url}/api/agents/webhook/{agent_id}` with
62
63
  `Authorization: Bearer <api_key>`. Session reads are
@@ -146,7 +147,8 @@ olbrain = Olbrain(api_key=os.environ["OLBRAIN_API_KEY"]) # server / sc
146
147
 
147
148
  `Olbrain(api_key=None, get_id_token=None, base_url=None, timeout=30)`:
148
149
  `api_key` must start `ak_`; `get_id_token` is a callable returning the
149
- token and is called before **every** request; `base_url` defaults to
150
+ token and is called before **every** request; `base_url` defaults to the
151
+ `OLBRAIN_AGENT_URL` environment variable if set, otherwise
150
152
  `https://webhook.olbrain.com`; `timeout` is in seconds. Give **exactly one** of
151
153
  `api_key` or `get_id_token`, or the constructor raises `ValidationError`.
152
154
 
olbrain/__init__.py CHANGED
@@ -39,7 +39,7 @@ from .exceptions import (
39
39
  BillingError,
40
40
  )
41
41
 
42
- __version__ = "0.5.0"
42
+ __version__ = "0.5.1"
43
43
  __author__ = "Olbrain Team"
44
44
  __email__ = "support@olbrain.com"
45
45
 
olbrain/client.py CHANGED
@@ -9,6 +9,7 @@ FIXES:
9
9
  - send_and_wait() now works correctly
10
10
  """
11
11
 
12
+ import os
12
13
  import requests
13
14
  import logging
14
15
  import time
@@ -150,7 +151,8 @@ class AgentClient:
150
151
  Args:
151
152
  agent_id: Agent identifier
152
153
  api_key: Access key (ak_…); 'sk_live_', 'org_live_', 'sk_' and 'org_' are also accepted
153
- agent_url: Optional agent URL (auto-constructed if not provided)
154
+ agent_url: Optional API base URL. Falls back to the OLBRAIN_AGENT_URL
155
+ environment variable, then https://webhook.olbrain.com
154
156
 
155
157
  Raises:
156
158
  ValueError: If agent_id or api_key is invalid
@@ -167,12 +169,9 @@ class AgentClient:
167
169
  self.agent_id = agent_id
168
170
  self.api_key = api_key
169
171
 
170
- # Auto-construct agent URL if not provided
171
- if agent_url:
172
- self.agent_url = agent_url.rstrip('/')
173
- else:
174
- # The Olbrain API. The old run.app host this SDK defaulted to no longer exists.
175
- self.agent_url = "https://webhook.olbrain.com"
172
+ # Explicit argument, then OLBRAIN_AGENT_URL, then the Olbrain API
173
+ agent_url = agent_url or os.environ.get("OLBRAIN_AGENT_URL") or "https://webhook.olbrain.com"
174
+ self.agent_url = agent_url.rstrip('/')
176
175
 
177
176
  self._streams = {} # session_id -> MessageStream
178
177
  self._running = False
olbrain/olbrain.py CHANGED
@@ -5,6 +5,7 @@ Olbrain sign-in (get_id_token). The same API as the JavaScript SDK's `Olbrain`.
5
5
  """
6
6
 
7
7
  import json
8
+ import os
8
9
  from types import SimpleNamespace
9
10
  from typing import Any, Callable, Dict, Iterator, Optional
10
11
  from urllib.parse import urlencode
@@ -70,7 +71,7 @@ class Olbrain:
70
71
  raise ValidationError("api_key must be an Olbrain access key (ak_…)")
71
72
  self._api_key = api_key
72
73
  self._get_id_token = get_id_token
73
- self.base_url = (base_url or DEFAULT_BASE_URL).rstrip("/")
74
+ self.base_url = (base_url or os.environ.get("OLBRAIN_AGENT_URL") or DEFAULT_BASE_URL).rstrip("/")
74
75
  self.timeout = timeout
75
76
 
76
77
  def runs(agent_id):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: olbrain-python-sdk
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: Official Python SDK for Olbrain AI agents
5
5
  Home-page: https://github.com/Olbrain/olbrain-sdk
6
6
  Author: Olbrain Team
@@ -0,0 +1,14 @@
1
+ olbrain/AGENTS.md,sha256=LCUONEQy-OW3xQzZjBYwTQErK2d75QHpp__1DGoBDqA,13276
2
+ olbrain/__init__.py,sha256=damIVzm9Ju78DskFULa-GRUwllS3NSyguLWpYq2MDxM,1728
3
+ olbrain/client.py,sha256=GetL1pFa4KZ_7gtLs5ILsGtOQpAck-eCaDUy5kwh5z8,22093
4
+ olbrain/exceptions.py,sha256=fY8B4K8dts-NRwc8RROeFyXP18nUgJnvrrOvmzH555E,2243
5
+ olbrain/olbrain.py,sha256=MzdjTKv-1w7r94CLJ-hqLMWnpEhmZssP0yiP-Om8UkQ,8255
6
+ olbrain/research.py,sha256=DWUUWFkXOqicH2QkVf5g96n6UDyP-Mi8OmYFLbK6zWs,7599
7
+ olbrain/session.py,sha256=0Off9pW0dTKYL9hzFYwH35zeNT5R20M9UfOKlCybYuQ,6662
8
+ olbrain/streaming.py,sha256=YQDLStIkiZusA2du5JLtx2lwdCMAVWuOW9jsAZoRWxY,3532
9
+ olbrain/utils.py,sha256=NrOB61Zub7i-ITlfXPfwUFunRR9YXJIS3MYgqVvqigM,4262
10
+ olbrain_python_sdk-0.5.1.dist-info/licenses/LICENSE,sha256=_4Q6zZ9zlqqRkRm_ZNiGTkmrMeTJc88agU6c_O-c5sI,1068
11
+ olbrain_python_sdk-0.5.1.dist-info/METADATA,sha256=RmdZMmb2E8XdmdJPbXEpqXWDK5u_VrGIPrlWsjadTgQ,16369
12
+ olbrain_python_sdk-0.5.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
13
+ olbrain_python_sdk-0.5.1.dist-info/top_level.txt,sha256=iAqbGCG4mlzbE-zLwW4AgQv5_CI9enWxgc7yA9PttvM,8
14
+ olbrain_python_sdk-0.5.1.dist-info/RECORD,,
@@ -1,14 +0,0 @@
1
- olbrain/AGENTS.md,sha256=I2OIYFMmRbHOoORIb9JC-_d7BzW8Ai6kPtZH3-jnemI,13148
2
- olbrain/__init__.py,sha256=wGSzsv1hZ3mCn9iCoE6ZgOzjdofDNAhyaIqtfpzms7M,1728
3
- olbrain/client.py,sha256=YkmlthZ90V7lI_j4pj2SbancDnww0eoVDepAPJPYyKk,22073
4
- olbrain/exceptions.py,sha256=fY8B4K8dts-NRwc8RROeFyXP18nUgJnvrrOvmzH555E,2243
5
- olbrain/olbrain.py,sha256=_y2Qtq6NIQ_DkJW6PHAGiRjQz3__u-bfGeRCJS3-g1A,8206
6
- olbrain/research.py,sha256=DWUUWFkXOqicH2QkVf5g96n6UDyP-Mi8OmYFLbK6zWs,7599
7
- olbrain/session.py,sha256=0Off9pW0dTKYL9hzFYwH35zeNT5R20M9UfOKlCybYuQ,6662
8
- olbrain/streaming.py,sha256=YQDLStIkiZusA2du5JLtx2lwdCMAVWuOW9jsAZoRWxY,3532
9
- olbrain/utils.py,sha256=NrOB61Zub7i-ITlfXPfwUFunRR9YXJIS3MYgqVvqigM,4262
10
- olbrain_python_sdk-0.5.0.dist-info/licenses/LICENSE,sha256=_4Q6zZ9zlqqRkRm_ZNiGTkmrMeTJc88agU6c_O-c5sI,1068
11
- olbrain_python_sdk-0.5.0.dist-info/METADATA,sha256=MGS_Ev7Jn_c_jHjKxitEjzhVuvglPdsIJOi3mk_o76k,16369
12
- olbrain_python_sdk-0.5.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
13
- olbrain_python_sdk-0.5.0.dist-info/top_level.txt,sha256=iAqbGCG4mlzbE-zLwW4AgQv5_CI9enWxgc7yA9PttvM,8
14
- olbrain_python_sdk-0.5.0.dist-info/RECORD,,