Skip to content

Commit

Permalink
feat: Updated agents-api/agents_api/models/agent/l (#87)
Browse files Browse the repository at this point in the history
Co-authored-by: sweep-ai[bot] <128439645+sweep-ai[bot]@users.noreply.github.com>
  • Loading branch information
sweep-ai[bot] committed Apr 13, 2024
1 parent 1855d0d commit ebd1b1e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions agents-api/agents_api/models/agent/list_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,28 @@ def list_agents_query(
metadata_filter: dict[str, Any] = {},
client: CozoClient = client,
) -> pd.DataFrame:
"""
Constructs and executes a datalog query to list agents from the 'cozodb' database.
Parameters:
developer_id: UUID of the developer.
limit: Maximum number of agents to return.
offset: Number of agents to skip before starting to collect the result set.
metadata_filter: Dictionary to filter agents based on metadata.
client: Instance of CozoClient to execute the query.
Returns:
A pandas DataFrame containing the query results.
"""
# Transforms the metadata_filter dictionary into a string representation for the datalog query.
metadata_filter_str = ", ".join(
[
f"metadata->{json.dumps(k)} == {json.dumps(v)}"
for k, v in metadata_filter.items()
]
)

# Datalog query to retrieve agent information based on filters, sorted by creation date in descending order.
query = f"""
{{
input[developer_id] <- [[to_uuid($developer_id)]]
Expand Down

0 comments on commit ebd1b1e

Please sign in to comment.