abacusai.agent — AbacusAI documentation

# abacusai.agent

## Classes

`AgentVersion` | A version of an AI agent.
`WorkflowGraph` | An Agent workflow graph. The edges define the node invokation order. The workflow must follow linear invokation order.
`CodeSource` | Code source for python-based custom feature groups and models
`AbstractApiClass` |
`Agent` | An AI agent.

## Module Contents

class abacusai.agent.AgentVersion(client, agentVersion=None, status=None, agentId=None, agentConfig=None, publishingStartedAt=None, publishingCompletedAt=None, pendingDeploymentIds=None, failedDeploymentIds=None, error=None, agentExecutionConfig=None, codeSource={}, workflowGraph={})

  Bases: `abacusai.return_class.AbstractApiClass`

  A version of an AI agent.

  Parameters:

    - client (ApiClient) – An authenticated API Client instance

    - agentVersion (str) – The unique identifier of an agent version.

    - status (str) – The current status of the model.

    - agentId (str) – A reference to the agent this version belongs to.

    - agentConfig (dict) – The config options used to create this agent.

    - publishingStartedAt (str) – The start time and date of the training process in ISO-8601 format.

    - publishingCompletedAt (str) – The end time and date of the training process in ISO-8601 format.

    - pendingDeploymentIds (list) – List of deployment IDs where deployment is pending.

    - failedDeploymentIds (list) – List of failed deployment IDs.

    - error (str) – Relevant error if the status is FAILED.

    - agentExecutionConfig (dict) – The config for arguments used to execute the agent.

    - codeSource (CodeSource) – If a python model, information on where the source code is located.

    - workflowGraph (WorkflowGraph) – The workflow graph for the agent.

  __repr__()

    Return repr(self).

  to_dict()

    Get a dict representation of the parameters in this class

    Returns:

      The dict value representation of the class parameters

    Return type:

      dict

  refresh()

    Calls describe and refreshes the current object’s fields

    Returns:

      The current object

    Return type:

      AgentVersion

  describe()

    Retrieves a full description of the specified agent version.

    Parameters:

      agent_version (str) – Unique string identifier of the agent version.

    Returns:

      A agent version.

    Return type:

      AgentVersion

  wait_for_publish(timeout=None)

    A waiting call until agent gets published.

    Parameters:

      timeout (int) – The waiting time given to the call to finish, if it doesn’t finish by the allocated time, the call is said to be timed out.

  get_status()

    Gets the status of the model version under training.

    Returns:

      A string describing the status of a model training (pending, complete, etc.).

    Return type:

      str

class abacusai.agent.WorkflowGraph

  Bases: `abacusai.api_class.abstract.ApiClass`

  An Agent workflow graph. The edges define the node invokation order. The workflow must follow linear invokation order.

  Parameters:

    - nodes (List[WorkflowGraphNode]) – A list of nodes in the workflow graph.

    - edges (List[WorkflowGraphEdge]) – A list of edges in the workflow graph, where each edge is a tuple of source, target and details.

  nodes: List[WorkflowGraphNode]
  edges: List[WorkflowGraphEdge]
  to_dict()

    Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary.

  classmethod from_dict(graph)
    Parameters:

      graph (dict)

class abacusai.agent.CodeSource(client, sourceType=None, sourceCode=None, applicationConnectorId=None, applicationConnectorInfo=None, packageRequirements=None, status=None, error=None, publishingMsg=None, moduleDependencies=None)

  Bases: `abacusai.return_class.AbstractApiClass`

  Code source for python-based custom feature groups and models

  Parameters:

    - client (ApiClient) – An authenticated API Client instance

    - sourceType (str) – The type of the source, one of TEXT, PYTHON, FILE_UPLOAD, or APPLICATION_CONNECTOR

    - sourceCode (str) – If the type of the source is TEXT, the raw text of the function

    - applicationConnectorId (str) – The Application Connector to fetch the code from

    - applicationConnectorInfo (str) – Args passed to the application connector to fetch the code

    - packageRequirements (list) – The pip package dependencies required to run the code

    - status (str) – The status of the code and validations

    - error (str) – If the status is failed, an error message describing what went wrong

    - publishingMsg (dict) – Warnings in the source code

    - moduleDependencies (list) – The list of internal modules dependencies required to run the code

  __repr__()

    Return repr(self).

  to_dict()

    Get a dict representation of the parameters in this class

    Returns:

      The dict value representation of the class parameters

    Return type:

      dict

  import_as_cell()

    Adds the source code as an unexecuted cell in the notebook.

class abacusai.agent.AbstractApiClass(client, id)
  __eq__(other)

    Return self==value.

  _get_attribute_as_dict(attribute)

class abacusai.agent.Agent(client, name=None, agentId=None, createdAt=None, projectId=None, notebookId=None, predictFunctionName=None, sourceCode=None, agentConfig=None, memory=None, trainingRequired=None, agentExecutionConfig=None, codeSource={}, latestAgentVersion={}, workflowGraph={})

  Bases: `abacusai.return_class.AbstractApiClass`

  An AI agent.

  Parameters:

    - client (ApiClient) – An authenticated API Client instance

    - name (str) – The user-friendly name for the agent.

    - agentId (str) – The unique identifier of the agent.

    - createdAt (str) – Date and time at which the agent was created.

    - projectId (str) – The project this agent belongs to.

    - notebookId (str) – The notebook associated with the agent.

    - predictFunctionName (str) – Name of the function found in the source code that will be executed run predictions through agent. It is not executed when this function is run.

    - sourceCode (str) – Python code used to make the agent.

    - agentConfig (dict) – The config options used to create this agent.

    - memory (int) – Memory in GB specified for the deployment resources for the agent.

    - trainingRequired (bool) – Whether training is required to deploy the latest agent code.

    - agentExecutionConfig (dict) – The config for arguments used to execute the agent.

    - latestAgentVersion (AgentVersion) – The latest agent version.

    - codeSource (CodeSource) – If a python model, information on the source code

    - workflowGraph (WorkflowGraph) – The workflow graph for the agent.

  __repr__()

    Return repr(self).

  to_dict()

    Get a dict representation of the parameters in this class

    Returns:

      The dict value representation of the class parameters

    Return type:

      dict

  refresh()

    Calls describe and refreshes the current object’s fields

    Returns:

      The current object

    Return type:

      Agent

  describe()

    Retrieves a full description of the specified model.

    Parameters:

      agent_id (str) – Unique string identifier associated with the model.

    Returns:

      Description of the agent.

    Return type:

      Agent

  list_versions(limit=100, start_after_version=None)

    List all versions of an agent.

    Parameters:

      - limit (int) – If provided, limits the number of agent versions returned.

      - start_after_version (str) – Unique string identifier of the version after which the list starts.

    Returns:

      An array of Agent versions.

    Return type:

      list[AgentVersion]

  wait_for_publish(timeout=None)

    A waiting call until agent is published.

    Parameters:

      timeout (int) – The waiting time given to the call to finish, if it doesn’t finish by the allocated time, the call is said to be timed out.

  get_status()

    Gets the status of the agent publishing.

    Returns:

      A string describing the status of a agent publishing (pending, complete, etc.).

    Return type:

      str