Skip to content

Commit 1be5357

Browse files
Merge pull request #1040 from julep-ai/dev
dev -> main
2 parents 2ae5fe1 + 0509485 commit 1be5357

File tree

522 files changed

+23673
-23399
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

522 files changed

+23673
-23399
lines changed

.env.example

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ GOOGLE_APPLICATION_CREDENTIALS=.keys/julep-vertexai-svc.json
4747
### > Set to either "voyage/voyage-3" or "Alibaba-NLP/gte-large-en-v1.5"
4848
### > Use Alibaba-NLP/gte-large-en-v1.5 with local embedding server
4949

50-
EMBEDDING_MODEL_ID=voyage/voyage-3
51-
EMBEDDING_MODEL_ID=Alibaba-NLP/gte-large-en-v1.5
50+
EMBEDDING_MODEL_ID=openai/text-embedding-3-large
5251

5352
AGENTS_API_HOSTNAME=localhost
5453
AGENTS_API_PROTOCOL=http

.github/workflows/lint-agents-api-pr.yml

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ jobs:
2323
uses: astral-sh/setup-uv@v4
2424
with:
2525
enable-cache: true
26+
27+
- name: Install Go migrate
28+
uses: jaxxstorm/[email protected]
29+
with: # Grab the latest version
30+
repo: golang-migrate/migrate
2631

2732
- name: Set up python and install dependencies
2833
run: |

.github/workflows/test-agents-api-pr.yml

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ jobs:
2323
uses: astral-sh/setup-uv@v4
2424
with:
2525
enable-cache: true
26+
27+
- name: Install Go migrate
28+
uses: jaxxstorm/[email protected]
29+
with: # Grab the latest version
30+
repo: golang-migrate/migrate
2631

2732
- name: Set up python and install dependencies
2833
run: |

.github/workflows/typecheck-agents-api-pr.yml

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ jobs:
3131
uses: astral-sh/setup-uv@v4
3232
with:
3333
enable-cache: true
34+
35+
- name: Install Go migrate
36+
uses: jaxxstorm/[email protected]
37+
with: # Grab the latest version
38+
repo: golang-migrate/migrate
3439

3540
- name: Set up python and install dependencies
3641
run: |

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ ngrok*
1010
*/node_modules/
1111
.aider*
1212
.vscode/
13+
schema.sql

agents-api/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
notebooks/
2+
13
# Local database files
2-
cozo.db
34
temporal.db
45
*.bak
56
*.dat

agents-api/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ COPY . ./
3030
ENV PYTHONUNBUFFERED=1
3131
ENV GUNICORN_CMD_ARGS="--capture-output --enable-stdio-inheritance"
3232

33-
ENTRYPOINT ["uv", "run", "gunicorn", "agents_api.web:app", "-c", "gunicorn_conf.py"]
33+
ENTRYPOINT ["uv", "run", "--offline", "--no-sync", "gunicorn", "agents_api.web:app", "-c", "gunicorn_conf.py"]

agents-api/Dockerfile.migration

-22
This file was deleted.

agents-api/Dockerfile.worker

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ COPY . ./
3030
ENV PYTHONUNBUFFERED=1
3131
ENV GUNICORN_CMD_ARGS="--capture-output --enable-stdio-inheritance"
3232

33-
ENTRYPOINT ["uv", "run", "python", "-m", "agents_api.worker"]
33+
ENTRYPOINT ["uv", "run", "--offline", "--no-sync", "python", "-m", "agents_api.worker"]
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
from typing import Callable
2-
31
from temporalio import activity
42

53
from ..env import testing
64

75

86
async def demo_activity(a: int, b: int) -> int:
97
# Should throw an error if testing is not enabled
10-
raise Exception("This should not be called in production")
8+
msg = "This should not be called in production"
9+
raise Exception(msg)
1110

1211

1312
async def mock_demo_activity(a: int, b: int) -> int:
1413
return a + b
1514

1615

17-
demo_activity: Callable[[int, int], int] = activity.defn(name="demo_activity")(
16+
demo_activity = activity.defn(name="demo_activity")(
1817
demo_activity if not testing else mock_demo_activity
1918
)

agents-api/agents_api/activities/embed_docs.py

-75
This file was deleted.

agents-api/agents_api/activities/excecute_api_call.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
import base64
2-
from typing import Any, Optional, TypedDict, Union
2+
from typing import Any, TypedDict
33

44
import httpx
55
from beartype import beartype
66
from temporalio import activity
77

88
from ..autogen.openapi_model import ApiCallDef
9-
from ..common.storage_handler import auto_blob_store
109
from ..env import testing
1110

1211

1312
class RequestArgs(TypedDict):
14-
content: Optional[str]
15-
data: Optional[dict[str, Any]]
16-
json_: Optional[dict[str, Any]]
17-
cookies: Optional[dict[str, str]]
18-
params: Optional[Union[str, dict[str, Any]]]
19-
url: Optional[str]
20-
headers: Optional[dict[str, str]]
13+
content: str | None
14+
data: dict[str, Any] | None
15+
json_: dict[str, Any] | None
16+
cookies: dict[str, str] | None
17+
params: str | dict[str, Any] | None
18+
url: str | None
19+
headers: dict[str, str] | None
2120

2221

23-
@auto_blob_store(deep=True)
2422
@beartype
2523
async def execute_api_call(
2624
api_call: ApiCallDef,

agents-api/agents_api/activities/execute_integration.py

+24-18
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
from beartype import beartype
44
from temporalio import activity
55

6+
from ..app import app
67
from ..autogen.openapi_model import BaseIntegrationDef
78
from ..clients import integrations
89
from ..common.exceptions.tools import IntegrationExecutionException
910
from ..common.protocol.tasks import ExecutionInput, StepContext
10-
from ..common.storage_handler import auto_blob_store
1111
from ..env import testing
12-
from ..models.tools import get_tool_args_from_metadata
12+
from ..queries import tools
1313

1414

15-
@auto_blob_store(deep=True)
1615
@beartype
1716
async def execute_integration(
1817
context: StepContext,
@@ -22,23 +21,35 @@ async def execute_integration(
2221
setup: dict[str, Any] = {},
2322
) -> Any:
2423
if not isinstance(context.execution_input, ExecutionInput):
25-
raise TypeError("Expected ExecutionInput type for context.execution_input")
24+
msg = "Expected ExecutionInput type for context.execution_input"
25+
raise TypeError(msg)
2626

2727
developer_id = context.execution_input.developer_id
2828
agent_id = context.execution_input.agent.id
29+
30+
if context.execution_input.task is None:
31+
msg = "Task cannot be None in execution_input"
32+
raise ValueError(msg)
33+
2934
task_id = context.execution_input.task.id
3035

31-
merged_tool_args = get_tool_args_from_metadata(
32-
developer_id=developer_id, agent_id=agent_id, task_id=task_id, arg_type="args"
36+
merged_tool_args = await tools.get_tool_args_from_metadata(
37+
developer_id=developer_id,
38+
agent_id=agent_id,
39+
task_id=task_id,
40+
arg_type="args",
41+
connection_pool=app.state.postgres_pool,
3342
)
3443

35-
merged_tool_setup = get_tool_args_from_metadata(
36-
developer_id=developer_id, agent_id=agent_id, task_id=task_id, arg_type="setup"
44+
merged_tool_setup = await tools.get_tool_args_from_metadata(
45+
developer_id=developer_id,
46+
agent_id=agent_id,
47+
task_id=task_id,
48+
arg_type="setup",
49+
connection_pool=app.state.postgres_pool,
3750
)
3851

39-
arguments = (
40-
merged_tool_args.get(tool_name, {}) | (integration.arguments or {}) | arguments
41-
)
52+
arguments = merged_tool_args.get(tool_name, {}) | (integration.arguments or {}) | arguments
4253

4354
setup = merged_tool_setup.get(tool_name, {}) | (integration.setup or {}) | setup
4455

@@ -53,10 +64,7 @@ async def execute_integration(
5364
arguments=arguments,
5465
)
5566

56-
if (
57-
"error" in integration_service_response
58-
and integration_service_response["error"]
59-
):
67+
if integration_service_response.get("error"):
6068
raise IntegrationExecutionException(
6169
integration=integration,
6270
error=integration_service_response["error"],
@@ -69,9 +77,7 @@ async def execute_integration(
6977
integration_str = integration.provider + (
7078
"." + integration.method if integration.method else ""
7179
)
72-
activity.logger.error(
73-
f"Error in execute_integration {integration_str}: {e}"
74-
)
80+
activity.logger.error(f"Error in execute_integration {integration_str}: {e}")
7581

7682
raise
7783

0 commit comments

Comments
 (0)