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.

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
example_extraction: str | int | bool | float | list | dict
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 (WorkflowNodeInputType) – The type of the input.

  • 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.

name: str
variable_type: abacusai.api_class.enums.WorkflowNodeInputType
variable_source: str
source_prop: str
is_required: bool
default_value: Any
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
schema_prop: str
runtime_schema: bool
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.

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.

name: str
variable_type: abacusai.api_class.enums.WorkflowNodeOutputType | str
__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.WorkflowGraphNode(name, input_mappings=None, output_mappings=None, function=None, function_name=None, source_code=None, input_schema=None, output_schema=None, template_metadata=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)

Additional Attributes:

function_name (str): The name of the function. source_code (str): The source code of the function.

template_metadata
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)
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]
primary_start_node: str | WorkflowGraphNode
common_source_code: 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(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
text: str
document_contents: 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.

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
default_value: str
is_required: bool
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
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)