diff --git a/agents-api/agents_api/models/agent/create_agent.py b/agents-api/agents_api/models/agent/create_agent.py index 1080a30a1..47ea196f4 100644 --- a/agents-api/agents_api/models/agent/create_agent.py +++ b/agents-api/agents_api/models/agent/create_agent.py @@ -1,3 +1,8 @@ +""" +This module contains the functionality for creating agents in the CozoDB database. +It includes functions to construct and execute datalog queries for inserting new agent records. +""" + from uuid import UUID import pandas as pd @@ -7,6 +12,23 @@ from ...common.utils.cozo import cozo_process_mutate_data +""" +Constructs and executes a datalog query to create a new agent in the database. + +Parameters: +- agent_id (UUID): The unique identifier for the agent. +- developer_id (UUID): The unique identifier for the developer creating the agent. +- name (str): The name of the agent. +- about (str): A description of the agent. +- instructions (list[str], optional): A list of instructions for using the agent. Defaults to an empty list. +- model (str, optional): The model identifier for the agent. Defaults to "julep-ai/samantha-1-turbo". +- metadata (dict, optional): A dictionary of metadata for the agent. Defaults to an empty dict. +- default_settings (dict, optional): A dictionary of default settings for the agent. Defaults to an empty dict. +- client (CozoClient, optional): The CozoDB client instance to use for the query. Defaults to a preconfigured client instance. + +Returns: +pd.DataFrame: A DataFrame containing the results of the query execution. +""" def create_agent_query( agent_id: UUID, developer_id: UUID, @@ -28,6 +50,7 @@ def create_agent_query( ) # Create default agent settings + # Construct a query to insert default settings for the new agent default_settings_query = f""" ?[{settings_cols}] <- $settings_vals @@ -36,6 +59,7 @@ def create_agent_query( }} """ # create the agent + # Construct a query to insert the new agent record into the agents table agent_query = """ ?[agent_id, developer_id, model, name, about, metadata, instructions] <- [ [$agent_id, $developer_id, $model, $name, $about, $metadata, $instructions]