abacusai.api_class.ai_agents

Classes

FieldDescriptor

Configs for vector store indexing.

JSONSchema

WorkflowNodeInputMapping

Represents a mapping of inputs to a workflow node.

WorkflowNodeInputSchema

A schema conformant to react-jsonschema-form for workflow node input.

WorkflowNodeOutputMapping

Represents a mapping of output from a workflow node.

WorkflowNodeOutputSchema

A schema conformant to react-jsonschema-form for a workflow node output.

TriggerConfig

Represents the configuration for a trigger workflow node.

WorkflowGraphNode

Represents a node in an Agent workflow graph.

WorkflowGraphEdge

Represents an edge in an Agent workflow graph.

WorkflowGraph

Represents an Agent workflow graph.

AgentConversationMessage

Message format for agent conversation

WorkflowNodeTemplateConfig

Represents a WorkflowNode template config.

WorkflowNodeTemplateInput

Represents an input to the workflow node generated using template.

WorkflowNodeTemplateOutput

Represents an output returned by the workflow node generated using template.

Functions

validate_input_dict_param(dict_object, friendly_class_name)

Module Contents

abacusai.api_class.ai_agents.validate_input_dict_param(dict_object, friendly_class_name, must_contain=[])
class abacusai.api_class.ai_agents.FieldDescriptor

Bases: abacusai.api_class.abstract.ApiClass

Configs for vector store indexing.

Parameters:
  • field (str) – The field to be extracted. This will be used as the key in the response.

  • description (str) – The description of this field. If not included, the response_field will be used.

  • example_extraction (Union[str, int, bool, float]) – An example of this extracted field.

  • type (FieldDescriptorType) – The type of this field. If not provided, the default type is STRING.

field: str
description: str = None
example_extraction: str | int | bool | float | list | dict = None
type: abacusai.api_class.enums.FieldDescriptorType
class abacusai.api_class.ai_agents.JSONSchema
classmethod from_fields_list(fields_list)
Parameters:

fields_list (List[str])

classmethod to_fields_list(json_schema)
Return type:

List[str]

class abacusai.api_class.ai_agents.WorkflowNodeInputMapping

Bases: abacusai.api_class.abstract.ApiClass

Represents a mapping of inputs to a workflow node.

Parameters:
  • name (str) – The name of the input variable of the node function.

  • variable_type (Union[WorkflowNodeInputType, str]) – The type of the input. If the type is IGNORE, the input will be ignored.

  • variable_source (str) – The name of the node this variable is sourced from. If the type is WORKFLOW_VARIABLE, the value given by the source node will be directly used. If the type is USER_INPUT, the value given by the source node will be used as the default initial value before the user edits it. Set to None if the type is USER_INPUT and the variable doesn’t need a pre-filled initial value.

  • is_required (bool) – Indicates whether the input is required. Defaults to True.

  • description (str) – The description of this input.

  • constant_value (str) – The constant value of this input if variable type is CONSTANT. Only applicable for template nodes.

name: str
variable_type: abacusai.api_class.enums.WorkflowNodeInputType
variable_source: str = None
source_prop: str = None
is_required: bool = True
description: str = None
constant_value: str = None
__post_init__()
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(mapping)
Parameters:

mapping (dict)

class abacusai.api_class.ai_agents.WorkflowNodeInputSchema

Bases: abacusai.api_class.abstract.ApiClass, JSONSchema

A schema conformant to react-jsonschema-form for workflow node input.

To initialize a WorkflowNodeInputSchema dependent on another node’s output, use the from_workflow_node method.

Parameters:
  • json_schema (dict) – The JSON schema for the input, conformant to react-jsonschema-form specification. Must define keys like “title”, “type”, and “properties”. Supported elements include Checkbox, Radio Button, Dropdown, Textarea, Number, Date, and file upload. Nested elements, arrays, and other complex types are not supported.

  • ui_schema (dict) – The UI schema for the input, conformant to react-jsonschema-form specification.

json_schema: dict
ui_schema: dict
schema_source: str = None
schema_prop: str = None
runtime_schema: bool = False
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(schema)
Parameters:

schema (dict)

classmethod from_workflow_node(schema_source, schema_prop)

Creates a WorkflowNodeInputSchema instance which references the schema generated by a WorkflowGraphNode.

Parameters:
  • schema_source (str) – The name of the source WorkflowGraphNode.

  • schema_prop (str) – The name of the input schema parameter which source node outputs.

classmethod from_input_mappings(input_mappings)

Creates a json_schema for the input schema of the node from it’s input mappings.

Parameters:

input_mappings (List[WorkflowNodeInputMapping]) – The input mappings for the node.

class abacusai.api_class.ai_agents.WorkflowNodeOutputMapping

Bases: abacusai.api_class.abstract.ApiClass

Represents a mapping of output from a workflow node.

Parameters:
  • name (str) – The name of the output.

  • variable_type (Union[WorkflowNodeOutputType, str]) – The type of the output in the form of an enum or a string.

  • description (str) – The description of this output.

name: str
variable_type: abacusai.api_class.enums.WorkflowNodeOutputType | str
description: str = None
__post_init__()
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(mapping)
Parameters:

mapping (dict)

class abacusai.api_class.ai_agents.WorkflowNodeOutputSchema

Bases: abacusai.api_class.abstract.ApiClass, JSONSchema

A schema conformant to react-jsonschema-form for a workflow node output.

Parameters:

json_schema (dict) – The JSON schema for the output, conformant to react-jsonschema-form specification.

json_schema: dict
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(schema)
Parameters:

schema (dict)

class abacusai.api_class.ai_agents.TriggerConfig

Bases: abacusai.api_class.abstract.ApiClass

Represents the configuration for a trigger workflow node.

Parameters:

sleep_time (int) – The time in seconds to wait before the node gets executed again.

sleep_time: int = None
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(configs)
Parameters:

configs (dict)

class abacusai.api_class.ai_agents.WorkflowGraphNode(name, function=None, input_mappings=None, output_mappings=None, function_name=None, source_code=None, input_schema=None, output_schema=None, template_metadata=None, trigger_config=None)

Bases: abacusai.api_class.abstract.ApiClass

Represents a node in an Agent workflow graph.

Parameters:
  • name (str) – A unique name for the workflow node.

  • input_mappings (List[WorkflowNodeInputMapping]) – List of input mappings for the node. Each arg/kwarg of the node function should have a corresponding input mapping.

  • output_mappings (List[WorkflowNodeOutputMapping]) – List of output mappings for the node. Each field in the returned dict/AgentResponse must have a corresponding output mapping.

  • function (callable) – The callable node function reference.

  • input_schema (WorkflowNodeInputSchema) – The react json schema for the user input variables.

  • output_schema (WorkflowNodeOutputSchema) – The react json schema for the output to be shown on UI.

  • function_name (str)

  • source_code (str)

  • template_metadata (dict)

  • trigger_config (TriggerConfig)

Additional Attributes:

function_name (str): The name of the function. source_code (str): The source code of the function. trigger_config (TriggerConfig): The configuration for a trigger workflow node.

template_metadata = None
trigger_config = None
classmethod _raw_init(name, input_mappings=None, output_mappings=None, function=None, function_name=None, source_code=None, input_schema=None, output_schema=None, template_metadata=None, trigger_config=None)
Parameters:
classmethod from_template(template_name, name, configs=None, input_mappings=None, input_schema=None, output_schema=None, sleep_time=None)
Parameters:
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(node)
Parameters:

node (dict)

__setattr__(name, value)
__getattribute__(name)
class Outputs(node)
Parameters:

node (WorkflowGraphNode)

node
__getattr__(name)
property outputs
class abacusai.api_class.ai_agents.WorkflowGraphEdge(source, target, details=None)

Bases: abacusai.api_class.abstract.ApiClass

Represents an edge in an Agent workflow graph.

To make an edge conditional, provide {‘EXECUTION_CONDITION’: ‘<condition>’} key-value in the details dictionary. The condition should be a Pythonic expression string that evaluates to a boolean value and only depends on the outputs of the source node of the edge.

Parameters:
  • source (str) – The name of the source node of the edge.

  • target (str) – The name of the target node of the edge.

  • details (dict) – Additional details about the edge. Like the condition for edge execution.

source: str | WorkflowGraphNode
target: str | WorkflowGraphNode
details: dict
to_nx_edge()
class abacusai.api_class.ai_agents.WorkflowGraph

Bases: abacusai.api_class.abstract.ApiClass

Represents an Agent workflow graph.

The edges define the node invocation 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.

  • primary_start_node (Union[str, WorkflowGraphNode]) – The primary node to start the workflow from.

nodes: List[WorkflowGraphNode] = []
edges: List[WorkflowGraphEdge | Tuple[WorkflowGraphNode, WorkflowGraphNode, dict] | Tuple[str, str, dict]] = []
primary_start_node: str | WorkflowGraphNode = None
common_source_code: str = None
__post_init__()
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.api_class.ai_agents.AgentConversationMessage

Bases: abacusai.api_class.abstract.ApiClass

Message format for agent conversation

Parameters:
  • is_user (bool) – Whether the message is from the user.

  • text (str) – The message’s text.

  • document_contents (dict) – Dict of document name to document text in case of any document present.

is_user: bool = None
text: str = None
document_contents: dict = None
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.

class abacusai.api_class.ai_agents.WorkflowNodeTemplateConfig

Bases: abacusai.api_class.abstract.ApiClass

Represents a WorkflowNode template config.

Parameters:
  • name (str) – A unique name of the config.

  • description (str) – The description of this config.

  • default_value (str) – Default value of the config to be used if value is not provided during node initialization.

  • is_required (bool) – Indicates whether the config is required. Defaults to False.

name: str
description: str = None
default_value: str = None
is_required: bool = False
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(mapping)
Parameters:

mapping (dict)

class abacusai.api_class.ai_agents.WorkflowNodeTemplateInput

Bases: abacusai.api_class.abstract.ApiClass

Represents an input to the workflow node generated using template.

Parameters:
  • name (str) – A unique name of the input.

  • is_required (bool) – Indicates whether the input is required. Defaults to False.

  • description (str) – The description of this input.

name: str
is_required: bool = False
description: str = ''
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(mapping)
Parameters:

mapping (dict)

class abacusai.api_class.ai_agents.WorkflowNodeTemplateOutput

Bases: abacusai.api_class.abstract.ApiClass

Represents an output returned by the workflow node generated using template.

Parameters:
  • name (str) – The name of the output.

  • variable_type (WorkflowNodeOutputType) – The type of the output.

  • description (str) – The description of this output.

name: str
variable_type: abacusai.api_class.enums.WorkflowNodeOutputType
description: str = ''
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(mapping)
Parameters:

mapping (dict)