You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Warp API Python library provides convenient access to the Warp API REST API from any Python 3.9+
7
7
application. The library includes type definitions for all request params and response fields,
@@ -17,7 +17,7 @@ The full API of this library can be found in [api.md](api.md).
17
17
18
18
```sh
19
19
# install from PyPI
20
-
pip install warp-sdk
20
+
pip install warp-agent-sdk
21
21
```
22
22
23
23
## Usage
@@ -26,7 +26,7 @@ The full API of this library can be found in [api.md](api.md).
26
26
27
27
```python
28
28
import os
29
-
fromwarp_sdkimport WarpAPI
29
+
fromwarp_agent_sdkimport WarpAPI
30
30
31
31
client = WarpAPI(
32
32
api_key=os.environ.get("WARP_API_KEY"), # This is the default and can be omitted
@@ -108,7 +108,7 @@ Simply import `AsyncWarpAPI` instead of `WarpAPI` and use `await` with each API
108
108
```python
109
109
import os
110
110
import asyncio
111
-
fromwarp_sdkimport AsyncWarpAPI
111
+
fromwarp_agent_sdkimport AsyncWarpAPI
112
112
113
113
client = AsyncWarpAPI(
114
114
api_key=os.environ.get("WARP_API_KEY"), # This is the default and can be omitted
@@ -135,16 +135,16 @@ You can enable this by installing `aiohttp`:
135
135
136
136
```sh
137
137
# install from PyPI
138
-
pip install warp-sdk[aiohttp]
138
+
pip install warp-agent-sdk[aiohttp]
139
139
```
140
140
141
141
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
142
142
143
143
```python
144
144
import os
145
145
import asyncio
146
-
fromwarp_sdkimport DefaultAioHttpClient
147
-
fromwarp_sdkimport AsyncWarpAPI
146
+
fromwarp_agent_sdkimport DefaultAioHttpClient
147
+
fromwarp_agent_sdkimport AsyncWarpAPI
148
148
149
149
150
150
asyncdefmain() -> None:
@@ -175,7 +175,7 @@ Typed requests and responses provide autocomplete and documentation within your
175
175
Nested parameters are dictionaries, typed using `TypedDict`, for example:
176
176
177
177
```python
178
-
fromwarp_sdkimport WarpAPI
178
+
fromwarp_agent_sdkimport WarpAPI
179
179
180
180
client = WarpAPI()
181
181
@@ -188,29 +188,29 @@ print(response.config)
188
188
189
189
## Handling errors
190
190
191
-
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `warp_sdk.APIConnectionError` is raised.
191
+
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `warp_agent_sdk.APIConnectionError` is raised.
192
192
193
193
When the API returns a non-success status code (that is, 4xx or 5xx
194
-
response), a subclass of `warp_sdk.APIStatusError` is raised, containing `status_code` and `response` properties.
194
+
response), a subclass of `warp_agent_sdk.APIStatusError` is raised, containing `status_code` and `response` properties.
195
195
196
-
All errors inherit from `warp_sdk.APIError`.
196
+
All errors inherit from `warp_agent_sdk.APIError`.
197
197
198
198
```python
199
-
importwarp_sdk
200
-
fromwarp_sdkimport WarpAPI
199
+
importwarp_agent_sdk
200
+
fromwarp_agent_sdkimport WarpAPI
201
201
202
202
client = WarpAPI()
203
203
204
204
try:
205
205
client.agent.run(
206
206
prompt="Fix the bug in auth.go",
207
207
)
208
-
exceptwarp_sdk.APIConnectionError as e:
208
+
exceptwarp_agent_sdk.APIConnectionError as e:
209
209
print("The server could not be reached")
210
210
print(e.__cause__) # an underlying Exception, likely raised within httpx.
211
-
exceptwarp_sdk.RateLimitError as e:
211
+
exceptwarp_agent_sdk.RateLimitError as e:
212
212
print("A 429 status code was received; we should back off a bit.")
213
-
exceptwarp_sdk.APIStatusError as e:
213
+
exceptwarp_agent_sdk.APIStatusError as e:
214
214
print("Another non-200-range status code was received")
215
215
print(e.status_code)
216
216
print(e.response)
@@ -238,7 +238,7 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
238
238
You can use the `max_retries` option to configure or disable retry settings:
239
239
240
240
```python
241
-
fromwarp_sdkimport WarpAPI
241
+
fromwarp_agent_sdkimport WarpAPI
242
242
243
243
# Configure the default for all requests:
244
244
client = WarpAPI(
@@ -258,7 +258,7 @@ By default requests time out after 1 minute. You can configure this with a `time
258
258
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
259
259
260
260
```python
261
-
fromwarp_sdkimport WarpAPI
261
+
fromwarp_agent_sdkimport WarpAPI
262
262
263
263
# Configure the default for all requests:
264
264
client = WarpAPI(
@@ -312,7 +312,7 @@ if response.my_field is None:
312
312
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
313
313
314
314
```py
315
-
fromwarp_sdkimport WarpAPI
315
+
fromwarp_agent_sdkimport WarpAPI
316
316
317
317
client = WarpAPI()
318
318
response = client.agent.with_raw_response.run(
@@ -324,9 +324,9 @@ agent = response.parse() # get the object that `agent.run()` would have returne
324
324
print(agent.task_id)
325
325
```
326
326
327
-
These methods return an [`APIResponse`](https://github.com/warpdotdev/warp-sdk-python/tree/main/src/warp_sdk/_response.py) object.
327
+
These methods return an [`APIResponse`](https://github.com/warpdotdev/warp-sdk-python/tree/main/src/warp_agent_sdk/_response.py) object.
328
328
329
-
The async client returns an [`AsyncAPIResponse`](https://github.com/warpdotdev/warp-sdk-python/tree/main/src/warp_sdk/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
329
+
The async client returns an [`AsyncAPIResponse`](https://github.com/warpdotdev/warp-sdk-python/tree/main/src/warp_agent_sdk/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
330
330
331
331
#### `.with_streaming_response`
332
332
@@ -390,7 +390,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
414
414
415
415
```py
416
-
fromwarp_sdkimport WarpAPI
416
+
fromwarp_agent_sdkimport WarpAPI
417
417
418
418
with WarpAPI() as client:
419
419
# make requests here
@@ -441,8 +441,8 @@ If you've upgraded to the latest version but aren't seeing any new features you
441
441
You can determine the version that is being used at runtime with:
0 commit comments