acp-sdk 0.10.0__py3-none-any.whl → 0.10.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.
acp_sdk/server/server.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import asyncio
|
2
2
|
import os
|
3
|
+
import re
|
3
4
|
from collections.abc import AsyncGenerator, Awaitable
|
4
5
|
from contextlib import asynccontextmanager
|
5
6
|
from typing import Any, Callable
|
@@ -313,22 +314,33 @@ class Server:
|
|
313
314
|
return
|
314
315
|
|
315
316
|
url = os.getenv("PLATFORM_URL", "http://127.0.0.1:8333")
|
317
|
+
host = re.sub(r"localhost|127\.0\.0\.1", "host.docker.internal", self.server.config.host)
|
316
318
|
request_data = {
|
317
|
-
"location": f"http://{
|
319
|
+
"location": f"http://{host}:{self.server.config.port}",
|
318
320
|
}
|
321
|
+
await async_request_with_retry(lambda client, data=request_data: client.get(f"{url}/api/v1/providers"))
|
319
322
|
try:
|
320
323
|
await async_request_with_retry(
|
321
|
-
lambda client, data=request_data: client.post(
|
324
|
+
lambda client, data=request_data: client.post(
|
325
|
+
f"{url}/api/v1/providers", json=data, params={"auto_remove": True}
|
326
|
+
)
|
322
327
|
)
|
323
328
|
logger.info("Agent registered to the beeai server.")
|
324
329
|
|
325
330
|
# check missing env keyes
|
326
331
|
envs_request = await async_request_with_retry(lambda client: client.get(f"{url}/api/v1/variables"))
|
327
332
|
envs = envs_request.get("env")
|
333
|
+
os.environ["LLM_MODEL"] = "dummy"
|
334
|
+
os.environ["LLM_API_KEY"] = "dummy"
|
335
|
+
os.environ["LLM_API_BASE"] = f"{url.rstrip('/')}/api/v1/llm"
|
336
|
+
|
328
337
|
for agent in self.agents:
|
329
338
|
# register all available envs
|
330
339
|
missing_keyes = []
|
331
340
|
for env in agent.metadata.model_dump().get("env", []):
|
341
|
+
# Those envs are set to use LLM gateway from platform server
|
342
|
+
if env["name"] in {"LLM_MODEL", "LLM_API_KEY", "LLM_API_BASE"}:
|
343
|
+
continue
|
332
344
|
server_env = envs.get(env.get("name"))
|
333
345
|
if server_env:
|
334
346
|
logger.debug(f"Env variable {env['name']} = '{server_env}' added dynamically")
|
@@ -17,7 +17,7 @@ acp_sdk/server/context.py,sha256=MgnLV6qcDIhc_0BjW7r4Jj1tHts4ZuwpdTGIBnz2Mgo,103
|
|
17
17
|
acp_sdk/server/errors.py,sha256=GSO8yYIqEeX8Y4Lz86ks35dMTHiQiXuOrLYYx0eXsbI,2110
|
18
18
|
acp_sdk/server/executor.py,sha256=YL0J9cVY1QZtdTeqwjJaKDpB_T6_sByHlHc52kgNAJo,7742
|
19
19
|
acp_sdk/server/logging.py,sha256=Oc8yZigCsuDnHHPsarRzu0RX3NKaLEgpELM2yovGKDI,411
|
20
|
-
acp_sdk/server/server.py,sha256=
|
20
|
+
acp_sdk/server/server.py,sha256=slePybTpocXD8k9HxOvxCiyvigiDUdZmkz3kiI-dCFU,14113
|
21
21
|
acp_sdk/server/session.py,sha256=vGUVpKzUGefI1c7LeK08Bvd8zvJIRfsdJEt2KhYoEg0,764
|
22
22
|
acp_sdk/server/telemetry.py,sha256=lbB2ppijUcqbHUOn0e-15LGcVvT_qrMguq8qBokICac,2016
|
23
23
|
acp_sdk/server/types.py,sha256=gLb5wCkMYhmu2laj_ymK-TPfN9LSjRgKOP1H_893UzA,304
|
@@ -28,6 +28,6 @@ acp_sdk/server/store/postgresql_store.py,sha256=bHyAgf4vSn_07wGXXq6juFwm3JldYNOj
|
|
28
28
|
acp_sdk/server/store/redis_store.py,sha256=IKXvDseOFMcoGjVYPOkOBhPnJAchy_RyeMayKLoVCGA,1378
|
29
29
|
acp_sdk/server/store/store.py,sha256=jGmYy9oiuVjhYYJY8QRo4g2J2Qyt1HLTmq_eHy4aI7c,1806
|
30
30
|
acp_sdk/server/store/utils.py,sha256=JumEOMs1h1uGlnHnUGeguee-srGzT7_Y2NVEYt01QuY,92
|
31
|
-
acp_sdk-0.10.
|
32
|
-
acp_sdk-0.10.
|
33
|
-
acp_sdk-0.10.
|
31
|
+
acp_sdk-0.10.1.dist-info/METADATA,sha256=2CkcWAS4e-6bIeoFsv2eyxLcbeTSgy15gq3VCP1dxbE,1685
|
32
|
+
acp_sdk-0.10.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
33
|
+
acp_sdk-0.10.1.dist-info/RECORD,,
|
File without changes
|