Skip to content

Commit

Permalink
feat: Updated agents-api/agents_api/models/agent/g
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] committed Apr 13, 2024
1 parent 8dde47d commit 672a60e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions agents-api/agents_api/models/agent/get_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@
def get_agent_query(
developer_id: UUID, agent_id: UUID, client: CozoClient = client
) -> pd.DataFrame:
"""
Fetches agent details and default settings from the database.
This function constructs and executes a datalog query to retrieve information about a specific agent, including its default settings, based on the provided agent_id and developer_id.
Parameters:
- developer_id (UUID): The unique identifier for the developer.
- agent_id (UUID): The unique identifier for the agent.
- client (CozoClient, optional): The database client used to execute the query.
Returns:
- pd.DataFrame: A DataFrame containing the agent details and default settings.
"""
# Constructing a datalog query to retrieve agent details and default settings.
# The query uses input parameters for agent_id and developer_id to filter the results.
# It joins the 'agents' and 'agent_default_settings' relations to fetch comprehensive details.
query = """
{
input[agent_id, developer_id] <- [[to_uuid($agent_id), to_uuid($developer_id)]]
Expand Down Expand Up @@ -57,4 +73,6 @@ def get_agent_query(
}
"""

# Execute the constructed datalog query using the provided CozoClient.
# The result is returned as a pandas DataFrame.
return client.run(query, {"agent_id": str(agent_id), "developer_id": str(developer_id)})

0 comments on commit 672a60e

Please sign in to comment.