olbrain-python-sdk 0.3.1__tar.gz → 0.5.0__tar.gz

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.
Files changed (37) hide show
  1. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/MANIFEST.in +1 -1
  2. {olbrain_python_sdk-0.3.1/olbrain_python_sdk.egg-info → olbrain_python_sdk-0.5.0}/PKG-INFO +46 -38
  3. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/README.md +41 -33
  4. olbrain_python_sdk-0.5.0/olbrain/AGENTS.md +264 -0
  5. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/olbrain/__init__.py +14 -4
  6. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/olbrain/client.py +42 -200
  7. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/olbrain/exceptions.py +22 -0
  8. olbrain_python_sdk-0.5.0/olbrain/olbrain.py +241 -0
  9. olbrain_python_sdk-0.5.0/olbrain/research.py +200 -0
  10. olbrain_python_sdk-0.5.0/olbrain/streaming.py +95 -0
  11. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0/olbrain_python_sdk.egg-info}/PKG-INFO +46 -38
  12. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/olbrain_python_sdk.egg-info/SOURCES.txt +4 -1
  13. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/olbrain_python_sdk.egg-info/top_level.txt +0 -1
  14. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/pyproject.toml +6 -3
  15. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/setup.py +6 -5
  16. olbrain_python_sdk-0.5.0/tests/test_client.py +98 -0
  17. olbrain_python_sdk-0.5.0/tests/test_olbrain.py +215 -0
  18. olbrain_python_sdk-0.3.1/olbrain/streaming.py +0 -143
  19. olbrain_python_sdk-0.3.1/test_agent.py +0 -143
  20. olbrain_python_sdk-0.3.1/tests/test_client.py +0 -131
  21. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/.gitignore +0 -0
  22. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/LICENSE +0 -0
  23. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/examples/advanced_features.py +0 -0
  24. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/examples/basic_usage.py +0 -0
  25. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/examples/error_handling.py +0 -0
  26. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/examples/session_management.py +0 -0
  27. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/examples/streaming_responses.py +0 -0
  28. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/olbrain/session.py +0 -0
  29. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/olbrain/utils.py +0 -0
  30. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/olbrain_python_sdk.egg-info/dependency_links.txt +0 -0
  31. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/olbrain_python_sdk.egg-info/not-zip-safe +0 -0
  32. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/olbrain_python_sdk.egg-info/requires.txt +0 -0
  33. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/requirements.txt +0 -0
  34. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/setup.cfg +0 -0
  35. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/tests/__init__.py +0 -0
  36. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/tests/test_exceptions.py +0 -0
  37. {olbrain_python_sdk-0.3.1 → olbrain_python_sdk-0.5.0}/tests/test_session.py +0 -0
@@ -3,7 +3,7 @@ include README.md
3
3
  include LICENSE
4
4
  include requirements.txt
5
5
  include pyproject.toml
6
- recursive-include olbrain *.py
6
+ recursive-include olbrain *.py *.md
7
7
  recursive-exclude * __pycache__
8
8
  recursive-exclude * *.py[co]
9
9
  global-exclude .DS_Store
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: olbrain-python-sdk
3
- Version: 0.3.1
3
+ Version: 0.5.0
4
4
  Summary: Official Python SDK for Olbrain AI agents
5
- Home-page: https://github.com/Olbrain/olbrain-python-sdk
5
+ Home-page: https://github.com/Olbrain/olbrain-sdk
6
6
  Author: Olbrain Team
7
7
  Author-email: Olbrain Team <support@olbrain.com>
8
8
  License: MIT
9
- Project-URL: Homepage, https://github.com/Olbrain/olbrain-python-sdk
10
- Project-URL: Bug Reports, https://github.com/Olbrain/olbrain-python-sdk/issues
11
- Project-URL: Source, https://github.com/Olbrain/olbrain-python-sdk
9
+ Project-URL: Homepage, https://github.com/Olbrain/olbrain-sdk/tree/main/packages/python
10
+ Project-URL: Bug Reports, https://github.com/Olbrain/olbrain-sdk/issues
11
+ Project-URL: Source, https://github.com/Olbrain/olbrain-sdk
12
12
  Project-URL: Documentation, https://docs.olbrain.com/python-sdk
13
13
  Keywords: olbrain,ai,agents,chatbot,nlp,artificial intelligence,sdk,api,conversation,streaming
14
14
  Classifier: Development Status :: 4 - Beta
@@ -54,6 +54,8 @@ Dynamic: requires-python
54
54
 
55
55
  Official Python SDK for integrating Olbrain AI agents into your applications.
56
56
 
57
+ > **Coding assistants:** the complete API reference ships in the package as [`olbrain/AGENTS.md`](olbrain/AGENTS.md) (`site-packages/olbrain/AGENTS.md`).
58
+
57
59
  ## Installation
58
60
 
59
61
  ```bash
@@ -66,8 +68,8 @@ For local development and testing:
66
68
 
67
69
  ```bash
68
70
  # Clone the repository
69
- git clone https://github.com/Olbrain/olbrain-python-sdk.git
70
- cd olbrain-python-sdk
71
+ git clone https://github.com/Olbrain/olbrain-sdk.git
72
+ cd olbrain-sdk/packages/python
71
73
 
72
74
  # Create virtual environment
73
75
  python3 -m venv venv
@@ -84,7 +86,7 @@ pytest tests/
84
86
 
85
87
  Get your credentials from the Olbrain dashboard:
86
88
  - **Agent ID**: Your unique agent identifier
87
- - **API Key**: Starts with `sk_live_` (production) or `sk_` (test)
89
+ - **API Key**: an access key (`ak_…`) from Noesis → Settings → Organization → Access keys, or from the finish page Alchemist links to when it hands an agent over (that key works only for that agent)
88
90
 
89
91
  ### Basic Example
90
92
 
@@ -94,7 +96,7 @@ from olbrain import AgentClient
94
96
  # Initialize client
95
97
  client = AgentClient(
96
98
  agent_id="your-agent-id",
97
- api_key="sk_live_your_api_key"
99
+ api_key="ak_your_api_key"
98
100
  )
99
101
 
100
102
  # Create a session and send a message
@@ -113,7 +115,7 @@ client.close()
113
115
  from olbrain import AgentClient
114
116
 
115
117
  # Automatically closes client when done
116
- with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client:
118
+ with AgentClient(agent_id="your-agent-id", api_key="ak_your_key") as client:
117
119
  session_id = client.create_session(title="My Chat")
118
120
  response = client.send_and_wait(session_id, "What is machine learning?")
119
121
  print(response.text)
@@ -127,6 +129,21 @@ with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client
127
129
  - **Token Tracking** - Monitor usage and costs per request
128
130
  - **Model Override** - Switch models per-message
129
131
  - **Error Handling** - Comprehensive exception hierarchy
132
+ - **Workflow Agents** - Run workflow agents, read and control their runs, resolve approvals (`Olbrain`)
133
+ - **Research Agents** - Sessions, streamed turns, plans, reports and review (`Olbrain.research`, sign-ins only)
134
+
135
+ ### Workflow agents
136
+
137
+ ```python
138
+ import os
139
+ from olbrain import Olbrain
140
+
141
+ olbrain = Olbrain(api_key=os.environ["OLBRAIN_API_KEY"]) # keep the key on your server
142
+ run = olbrain.workflows.run("your-agent-id", payload={"url": "https://example.com"})
143
+ print(olbrain.runs.get("your-agent-id", run["run_id"]))
144
+ ```
145
+
146
+ See [`olbrain/AGENTS.md`](olbrain/AGENTS.md) for runs, approvals and research agents.
130
147
 
131
148
  ## Usage
132
149
 
@@ -137,7 +154,7 @@ Send a message and wait for the complete response:
137
154
  ```python
138
155
  from olbrain import AgentClient
139
156
 
140
- with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client:
157
+ with AgentClient(agent_id="your-agent-id", api_key="ak_your_key") as client:
141
158
  # Create a new chat session
142
159
  session_id = client.create_session(title="My Chat")
143
160
 
@@ -152,12 +169,12 @@ with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client
152
169
 
153
170
  ### 2. Real-Time Streaming (Callback Pattern)
154
171
 
155
- Receive messages in real-time as they arrive:
172
+ Receive new messages as they arrive (the client polls the session every 2 seconds):
156
173
 
157
174
  ```python
158
175
  from olbrain import AgentClient
159
176
 
160
- client = AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key")
177
+ client = AgentClient(agent_id="your-agent-id", api_key="ak_your_key")
161
178
 
162
179
  # Define message handler
163
180
  def on_message(msg):
@@ -189,7 +206,7 @@ Create, retrieve, and manage chat sessions:
189
206
  ```python
190
207
  from olbrain import AgentClient
191
208
 
192
- with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client:
209
+ with AgentClient(agent_id="your-agent-id", api_key="ak_your_key") as client:
193
210
  # Create session with metadata
194
211
  session = client.create_session(
195
212
  title="Support Chat",
@@ -208,15 +225,9 @@ with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client
208
225
  for msg in messages.get('messages', []):
209
226
  print(f"{msg['role']}: {msg['content']}")
210
227
 
211
- # Update session
212
- updated = client.update_session(session, title="Updated Chat Title")
213
-
214
228
  # Get session statistics
215
229
  stats = client.get_session_stats(session)
216
230
  print(f"Stats: {stats}")
217
-
218
- # Archive/delete session
219
- client.delete_session(session)
220
231
  ```
221
232
 
222
233
  ### 4. Model Override
@@ -226,7 +237,7 @@ Send messages using a specific model:
226
237
  ```python
227
238
  from olbrain import AgentClient
228
239
 
229
- with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client:
240
+ with AgentClient(agent_id="your-agent-id", api_key="ak_your_key") as client:
230
241
  session_id = client.create_session()
231
242
 
232
243
  # Use specific model for this request
@@ -246,7 +257,7 @@ Maintain conversation context:
246
257
  ```python
247
258
  from olbrain import AgentClient
248
259
 
249
- with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client:
260
+ with AgentClient(agent_id="your-agent-id", api_key="ak_your_key") as client:
250
261
  session_id = client.create_session(title="Q&A Session")
251
262
 
252
263
  # First message
@@ -277,7 +288,7 @@ from olbrain.exceptions import (
277
288
  )
278
289
 
279
290
  try:
280
- client = AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key")
291
+ client = AgentClient(agent_id="your-agent-id", api_key="ak_your_key")
281
292
  session_id = client.create_session()
282
293
  response = client.send_and_wait(session_id, "Hello")
283
294
 
@@ -305,24 +316,21 @@ finally:
305
316
 
306
317
  ### API Key
307
318
 
308
- The SDK validates API keys. Valid prefixes are:
309
- - `sk_live_` - Production keys
310
- - `org_live_` - Organization keys
311
- - `sk_` - Test keys
312
- - `org_` - Test organization keys
319
+ The SDK validates API keys. Access keys (`ak_`) are the only kind issued today; the older
320
+ `sk_live_`, `org_live_`, `sk_` and `org_` prefixes still pass validation.
313
321
 
314
322
  ```python
315
323
  # Valid API key
316
324
  client = AgentClient(
317
325
  agent_id="your-agent-id",
318
- api_key="sk_live_24c2859a0cf359b8aebbe3d8e9c60f0341d111b30004a56b428726edb354bec5"
326
+ api_key="ak_your_api_key_here"
319
327
  )
320
328
  ```
321
329
 
322
330
  ### Environment Variables
323
331
 
324
332
  ```bash
325
- export OLBRAIN_API_KEY="sk_live_your_api_key"
333
+ export OLBRAIN_API_KEY="ak_your_api_key"
326
334
  export OLBRAIN_AGENT_ID="your-agent-id"
327
335
  ```
328
336
 
@@ -348,10 +356,10 @@ client = AgentClient(agent_id="...", api_key="...")
348
356
  ### Common Issues
349
357
 
350
358
  **"Invalid API key" error**
351
- - Ensure your API key starts with `sk_live_`, `org_live_`, `sk_`, or `org_`
359
+ - Ensure your API key starts with `ak_` (or one of the older `sk_live_`, `org_live_`, `sk_`, `org_` prefixes)
352
360
  - Check that you copied the key correctly (no extra spaces)
353
361
 
354
- **"Stream connection failed" error**
362
+ **"Message poll failed" in the logs**
355
363
  - Check that your agent ID is correct
356
364
  - Verify you have a stable internet connection
357
365
  - Try restarting the client
@@ -397,8 +405,8 @@ The test will:
397
405
  |--------|-----------|---------|-------------|
398
406
  | `create_session()` | `title`, `user_id`, `metadata`, `on_message`, `mode`, `description` | `str` (session_id) | Create a new chat session |
399
407
  | `get_session(session_id)` | `session_id` | `SessionInfo` | Get session details |
400
- | `update_session(session_id, ...)` | `session_id`, `title`, `metadata`, `status` | `SessionInfo` | Update session properties |
401
- | `delete_session(session_id)` | `session_id` | `Dict` | Archive/delete a session |
408
+ | `update_session(session_id, ...)` | `session_id`, `title`, `metadata`, `status` | - | Not supported: raises `OlbrainError` (the Olbrain API has no endpoint for it) |
409
+ | `delete_session(session_id)` | `session_id` | - | Not supported: raises `OlbrainError` (the Olbrain API has no endpoint for it) |
402
410
  | `get_messages(session_id, ...)` | `session_id`, `limit`, `offset` | `Dict` | Get message history |
403
411
  | `get_session_stats(session_id)` | `session_id` | `Dict` | Get session statistics |
404
412
 
@@ -408,7 +416,7 @@ The test will:
408
416
  |--------|-----------|---------|-------------|
409
417
  | `send(session_id, message, ...)` | `session_id`, `message`, `user_id`, `metadata`, `model` | `Dict` | Send message (async with callback) |
410
418
  | `send_and_wait(session_id, message, ...)` | `session_id`, `message`, `user_id`, `metadata`, `model`, `timeout` | `ChatResponse` | Send and wait for response |
411
- | `listen(session_id, on_message)` | `session_id`, `on_message` | - | Start listening to session |
419
+ | `listen(session_id, on_message)` | `session_id`, `on_message` | - | Poll the session every 2 s and call `on_message` for each new message |
412
420
  | `run()` | - | - | Block and process streaming messages |
413
421
  | `close()` | - | - | Close client and cleanup resources |
414
422
 
@@ -509,7 +517,7 @@ python examples/basic_usage.py
509
517
 
510
518
  ## Support
511
519
 
512
- - **Issues**: [GitHub Issues](https://github.com/Olbrain/olbrain-python-sdk/issues)
520
+ - **Issues**: [GitHub Issues](https://github.com/Olbrain/olbrain-sdk/issues)
513
521
  - **Documentation**: See [examples/](examples/) directory
514
522
  - **API Status**: Check [status page](https://olbrain.com/status)
515
523
 
@@ -524,6 +532,6 @@ Current version: **0.2.0**
524
532
  ## Links
525
533
 
526
534
  - [PyPI Package](https://pypi.org/project/olbrain-python-sdk/)
527
- - [GitHub Repository](https://github.com/Olbrain/olbrain-python-sdk)
528
- - [Report Issues](https://github.com/Olbrain/olbrain-python-sdk/issues)
535
+ - [GitHub Repository](https://github.com/Olbrain/olbrain-sdk)
536
+ - [Report Issues](https://github.com/Olbrain/olbrain-sdk/issues)
529
537
  - [Olbrain Website](https://olbrain.com)
@@ -6,6 +6,8 @@
6
6
 
7
7
  Official Python SDK for integrating Olbrain AI agents into your applications.
8
8
 
9
+ > **Coding assistants:** the complete API reference ships in the package as [`olbrain/AGENTS.md`](olbrain/AGENTS.md) (`site-packages/olbrain/AGENTS.md`).
10
+
9
11
  ## Installation
10
12
 
11
13
  ```bash
@@ -18,8 +20,8 @@ For local development and testing:
18
20
 
19
21
  ```bash
20
22
  # Clone the repository
21
- git clone https://github.com/Olbrain/olbrain-python-sdk.git
22
- cd olbrain-python-sdk
23
+ git clone https://github.com/Olbrain/olbrain-sdk.git
24
+ cd olbrain-sdk/packages/python
23
25
 
24
26
  # Create virtual environment
25
27
  python3 -m venv venv
@@ -36,7 +38,7 @@ pytest tests/
36
38
 
37
39
  Get your credentials from the Olbrain dashboard:
38
40
  - **Agent ID**: Your unique agent identifier
39
- - **API Key**: Starts with `sk_live_` (production) or `sk_` (test)
41
+ - **API Key**: an access key (`ak_…`) from Noesis → Settings → Organization → Access keys, or from the finish page Alchemist links to when it hands an agent over (that key works only for that agent)
40
42
 
41
43
  ### Basic Example
42
44
 
@@ -46,7 +48,7 @@ from olbrain import AgentClient
46
48
  # Initialize client
47
49
  client = AgentClient(
48
50
  agent_id="your-agent-id",
49
- api_key="sk_live_your_api_key"
51
+ api_key="ak_your_api_key"
50
52
  )
51
53
 
52
54
  # Create a session and send a message
@@ -65,7 +67,7 @@ client.close()
65
67
  from olbrain import AgentClient
66
68
 
67
69
  # Automatically closes client when done
68
- with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client:
70
+ with AgentClient(agent_id="your-agent-id", api_key="ak_your_key") as client:
69
71
  session_id = client.create_session(title="My Chat")
70
72
  response = client.send_and_wait(session_id, "What is machine learning?")
71
73
  print(response.text)
@@ -79,6 +81,21 @@ with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client
79
81
  - **Token Tracking** - Monitor usage and costs per request
80
82
  - **Model Override** - Switch models per-message
81
83
  - **Error Handling** - Comprehensive exception hierarchy
84
+ - **Workflow Agents** - Run workflow agents, read and control their runs, resolve approvals (`Olbrain`)
85
+ - **Research Agents** - Sessions, streamed turns, plans, reports and review (`Olbrain.research`, sign-ins only)
86
+
87
+ ### Workflow agents
88
+
89
+ ```python
90
+ import os
91
+ from olbrain import Olbrain
92
+
93
+ olbrain = Olbrain(api_key=os.environ["OLBRAIN_API_KEY"]) # keep the key on your server
94
+ run = olbrain.workflows.run("your-agent-id", payload={"url": "https://example.com"})
95
+ print(olbrain.runs.get("your-agent-id", run["run_id"]))
96
+ ```
97
+
98
+ See [`olbrain/AGENTS.md`](olbrain/AGENTS.md) for runs, approvals and research agents.
82
99
 
83
100
  ## Usage
84
101
 
@@ -89,7 +106,7 @@ Send a message and wait for the complete response:
89
106
  ```python
90
107
  from olbrain import AgentClient
91
108
 
92
- with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client:
109
+ with AgentClient(agent_id="your-agent-id", api_key="ak_your_key") as client:
93
110
  # Create a new chat session
94
111
  session_id = client.create_session(title="My Chat")
95
112
 
@@ -104,12 +121,12 @@ with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client
104
121
 
105
122
  ### 2. Real-Time Streaming (Callback Pattern)
106
123
 
107
- Receive messages in real-time as they arrive:
124
+ Receive new messages as they arrive (the client polls the session every 2 seconds):
108
125
 
109
126
  ```python
110
127
  from olbrain import AgentClient
111
128
 
112
- client = AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key")
129
+ client = AgentClient(agent_id="your-agent-id", api_key="ak_your_key")
113
130
 
114
131
  # Define message handler
115
132
  def on_message(msg):
@@ -141,7 +158,7 @@ Create, retrieve, and manage chat sessions:
141
158
  ```python
142
159
  from olbrain import AgentClient
143
160
 
144
- with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client:
161
+ with AgentClient(agent_id="your-agent-id", api_key="ak_your_key") as client:
145
162
  # Create session with metadata
146
163
  session = client.create_session(
147
164
  title="Support Chat",
@@ -160,15 +177,9 @@ with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client
160
177
  for msg in messages.get('messages', []):
161
178
  print(f"{msg['role']}: {msg['content']}")
162
179
 
163
- # Update session
164
- updated = client.update_session(session, title="Updated Chat Title")
165
-
166
180
  # Get session statistics
167
181
  stats = client.get_session_stats(session)
168
182
  print(f"Stats: {stats}")
169
-
170
- # Archive/delete session
171
- client.delete_session(session)
172
183
  ```
173
184
 
174
185
  ### 4. Model Override
@@ -178,7 +189,7 @@ Send messages using a specific model:
178
189
  ```python
179
190
  from olbrain import AgentClient
180
191
 
181
- with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client:
192
+ with AgentClient(agent_id="your-agent-id", api_key="ak_your_key") as client:
182
193
  session_id = client.create_session()
183
194
 
184
195
  # Use specific model for this request
@@ -198,7 +209,7 @@ Maintain conversation context:
198
209
  ```python
199
210
  from olbrain import AgentClient
200
211
 
201
- with AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key") as client:
212
+ with AgentClient(agent_id="your-agent-id", api_key="ak_your_key") as client:
202
213
  session_id = client.create_session(title="Q&A Session")
203
214
 
204
215
  # First message
@@ -229,7 +240,7 @@ from olbrain.exceptions import (
229
240
  )
230
241
 
231
242
  try:
232
- client = AgentClient(agent_id="your-agent-id", api_key="sk_live_your_key")
243
+ client = AgentClient(agent_id="your-agent-id", api_key="ak_your_key")
233
244
  session_id = client.create_session()
234
245
  response = client.send_and_wait(session_id, "Hello")
235
246
 
@@ -257,24 +268,21 @@ finally:
257
268
 
258
269
  ### API Key
259
270
 
260
- The SDK validates API keys. Valid prefixes are:
261
- - `sk_live_` - Production keys
262
- - `org_live_` - Organization keys
263
- - `sk_` - Test keys
264
- - `org_` - Test organization keys
271
+ The SDK validates API keys. Access keys (`ak_`) are the only kind issued today; the older
272
+ `sk_live_`, `org_live_`, `sk_` and `org_` prefixes still pass validation.
265
273
 
266
274
  ```python
267
275
  # Valid API key
268
276
  client = AgentClient(
269
277
  agent_id="your-agent-id",
270
- api_key="sk_live_24c2859a0cf359b8aebbe3d8e9c60f0341d111b30004a56b428726edb354bec5"
278
+ api_key="ak_your_api_key_here"
271
279
  )
272
280
  ```
273
281
 
274
282
  ### Environment Variables
275
283
 
276
284
  ```bash
277
- export OLBRAIN_API_KEY="sk_live_your_api_key"
285
+ export OLBRAIN_API_KEY="ak_your_api_key"
278
286
  export OLBRAIN_AGENT_ID="your-agent-id"
279
287
  ```
280
288
 
@@ -300,10 +308,10 @@ client = AgentClient(agent_id="...", api_key="...")
300
308
  ### Common Issues
301
309
 
302
310
  **"Invalid API key" error**
303
- - Ensure your API key starts with `sk_live_`, `org_live_`, `sk_`, or `org_`
311
+ - Ensure your API key starts with `ak_` (or one of the older `sk_live_`, `org_live_`, `sk_`, `org_` prefixes)
304
312
  - Check that you copied the key correctly (no extra spaces)
305
313
 
306
- **"Stream connection failed" error**
314
+ **"Message poll failed" in the logs**
307
315
  - Check that your agent ID is correct
308
316
  - Verify you have a stable internet connection
309
317
  - Try restarting the client
@@ -349,8 +357,8 @@ The test will:
349
357
  |--------|-----------|---------|-------------|
350
358
  | `create_session()` | `title`, `user_id`, `metadata`, `on_message`, `mode`, `description` | `str` (session_id) | Create a new chat session |
351
359
  | `get_session(session_id)` | `session_id` | `SessionInfo` | Get session details |
352
- | `update_session(session_id, ...)` | `session_id`, `title`, `metadata`, `status` | `SessionInfo` | Update session properties |
353
- | `delete_session(session_id)` | `session_id` | `Dict` | Archive/delete a session |
360
+ | `update_session(session_id, ...)` | `session_id`, `title`, `metadata`, `status` | - | Not supported: raises `OlbrainError` (the Olbrain API has no endpoint for it) |
361
+ | `delete_session(session_id)` | `session_id` | - | Not supported: raises `OlbrainError` (the Olbrain API has no endpoint for it) |
354
362
  | `get_messages(session_id, ...)` | `session_id`, `limit`, `offset` | `Dict` | Get message history |
355
363
  | `get_session_stats(session_id)` | `session_id` | `Dict` | Get session statistics |
356
364
 
@@ -360,7 +368,7 @@ The test will:
360
368
  |--------|-----------|---------|-------------|
361
369
  | `send(session_id, message, ...)` | `session_id`, `message`, `user_id`, `metadata`, `model` | `Dict` | Send message (async with callback) |
362
370
  | `send_and_wait(session_id, message, ...)` | `session_id`, `message`, `user_id`, `metadata`, `model`, `timeout` | `ChatResponse` | Send and wait for response |
363
- | `listen(session_id, on_message)` | `session_id`, `on_message` | - | Start listening to session |
371
+ | `listen(session_id, on_message)` | `session_id`, `on_message` | - | Poll the session every 2 s and call `on_message` for each new message |
364
372
  | `run()` | - | - | Block and process streaming messages |
365
373
  | `close()` | - | - | Close client and cleanup resources |
366
374
 
@@ -461,7 +469,7 @@ python examples/basic_usage.py
461
469
 
462
470
  ## Support
463
471
 
464
- - **Issues**: [GitHub Issues](https://github.com/Olbrain/olbrain-python-sdk/issues)
472
+ - **Issues**: [GitHub Issues](https://github.com/Olbrain/olbrain-sdk/issues)
465
473
  - **Documentation**: See [examples/](examples/) directory
466
474
  - **API Status**: Check [status page](https://olbrain.com/status)
467
475
 
@@ -476,6 +484,6 @@ Current version: **0.2.0**
476
484
  ## Links
477
485
 
478
486
  - [PyPI Package](https://pypi.org/project/olbrain-python-sdk/)
479
- - [GitHub Repository](https://github.com/Olbrain/olbrain-python-sdk)
480
- - [Report Issues](https://github.com/Olbrain/olbrain-python-sdk/issues)
487
+ - [GitHub Repository](https://github.com/Olbrain/olbrain-sdk)
488
+ - [Report Issues](https://github.com/Olbrain/olbrain-sdk/issues)
481
489
  - [Olbrain Website](https://olbrain.com)