-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(agents-api): updated openapi schema for tasks spec (#350)
* openapi schema, definitions & sdks updated; endpoints added for tasks feature * follow convention for naming routes
- Loading branch information
1 parent
d1841b8
commit 7102509
Showing
83 changed files
with
4,056 additions
and
525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
agents-api/agents_api/models/execution/create_execution.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from uuid import UUID | ||
|
||
from ..utils import cozo_query | ||
from typing import Literal, Dict, Any | ||
|
||
|
||
@cozo_query | ||
def create_execution_query( | ||
task_id: UUID, | ||
execution_id: UUID, | ||
status: Literal[ | ||
"queued", "starting", "running", "waiting-for-input", "success", "failed" | ||
] = "queued", | ||
arguments: Dict[str, Any] = {}, | ||
) -> tuple[str, dict]: | ||
query = """""" | ||
return ( | ||
query, | ||
{ | ||
"task_id": str(task_id), | ||
"execution_id": str(execution_id), | ||
"status": status, | ||
"arguments": arguments, | ||
}, | ||
) |
12 changes: 12 additions & 0 deletions
12
agents-api/agents_api/models/execution/get_execution_status.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from typing import Literal | ||
from uuid import UUID | ||
|
||
from ..utils import cozo_query | ||
|
||
|
||
@cozo_query | ||
def get_execution_status_query(task_id: UUID, developer_id: UUID) -> tuple[str, dict]: | ||
task_id = str(task_id) | ||
developer_id = str(developer_id) | ||
query = """""" | ||
return (query, {"task_id": task_id, "developer_id": developer_id}) |
19 changes: 19 additions & 0 deletions
19
agents-api/agents_api/models/execution/get_execution_transition.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from uuid import UUID | ||
|
||
from ..utils import cozo_query | ||
|
||
|
||
@cozo_query | ||
def get_execution_transition_query( | ||
execution_id: UUID, transition_id: UUID, developer_id: UUID | ||
) -> tuple[str, dict]: | ||
|
||
query = """""" | ||
return ( | ||
query, | ||
{ | ||
"execution_id": str(execution_id), | ||
"transition_id": str(transition_id), | ||
"developer_id": str(developer_id), | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
This module contains the functionality for creating a new Task in the 'cozodb` database. | ||
It constructs and executes a datalog query to insert Task data. | ||
""" | ||
|
||
from uuid import UUID | ||
from typing import List, Optional, Dict, Any | ||
|
||
|
||
from ..utils import cozo_query | ||
|
||
|
||
@cozo_query | ||
def create_task_query( | ||
task_id: UUID, | ||
developer_id: UUID, | ||
agent_id: UUID, | ||
name: str, | ||
description: str, | ||
input_schema: Dict[str, any], | ||
tools_available: List[UUID] = [], | ||
workflows: List[Dict[str, Any]] = [], | ||
) -> tuple[str, dict]: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from uuid import UUID | ||
|
||
from ..utils import cozo_query | ||
|
||
|
||
@cozo_query | ||
def get_task_query(developer_id: UUID, task_id: UUID) -> tuple[str, dict]: | ||
query = """""" | ||
return (query, {"developer_id": str(developer_id), "task_id": str(task_id)}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from typing import Any | ||
from uuid import UUID | ||
|
||
from ...common.utils import json | ||
from ..utils import cozo_query | ||
|
||
|
||
@cozo_query | ||
def list_tasks_query( | ||
developer_id: UUID, | ||
limit: int = 100, | ||
offset: int = 0, | ||
# metadata_filter: dict[str, Any] = {}, | ||
) -> tuple[str, dict]: | ||
"""Lists tasks from the 'cozodb' database based on the provided filters. | ||
Parameters: | ||
developer_id (UUID): The developer's ID to filter tasks by. | ||
limit (int): The maximum number of tasks to return. | ||
offset (int): The offset from which to start listing tasks. | ||
Returns: | ||
pd.DataFrame: A DataFrame containing the queried task data. | ||
""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .routers import router |
Oops, something went wrong.