Skip to main content
Version: 1.0

aixplain.modules.agent.agent_response_data

Agent response data.

This module contains the AgentResponseData class, which is used to encapsulate the input, output, and execution details of an agent's response, including intermediate steps and execution statistics.

AgentResponseData Objects

class AgentResponseData()

[view_source]

A container for agent execution response data.

This class encapsulates the input, output, and execution details of an agent's response, including intermediate steps and execution statistics.

Attributes:

  • input Optional[Any] - The input provided to the agent.
  • output Optional[Any] - The final output from the agent.
  • session_id str - Identifier for the conversation session.
  • intermediate_steps List[Any] - List of steps taken during execution.
  • steps List[Any] - Reformatted list of steps with detailed execution info.
  • execution_stats Optional[Dict[str, Any]] - Statistics about the execution.
  • critiques str - Any critiques or feedback about the execution.

__init__

def __init__(input: Optional[Any] = None,
output: Optional[Any] = None,
session_id: str = "",
intermediate_steps: Optional[List[Any]] = None,
steps: Optional[List[Any]] = None,
execution_stats: Optional[Dict[str, Any]] = None,
critiques: Optional[str] = None)

[view_source]

Initialize a new AgentResponseData instance.

Arguments:

  • input Optional[Any], optional - The input provided to the agent. Defaults to None.
  • output Optional[Any], optional - The final output from the agent. Defaults to None.
  • session_id str, optional - Identifier for the conversation session. Defaults to "".
  • intermediate_steps Optional[List[Any]], optional - List of steps taken during execution. Defaults to None.
  • steps Optional[List[Any]], optional - Reformatted list of steps with detailed execution info. Defaults to None.
  • execution_stats Optional[Dict[str, Any]], optional - Statistics about the execution. Defaults to None.
  • critiques Optional[str], optional - Any critiques or feedback about the execution. Defaults to None.

from_dict

@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "AgentResponseData"

[view_source]

Create an AgentResponseData instance from a dictionary.

Arguments:

  • data Dict[str, Any] - Dictionary containing response data with keys:
    • input: The input provided to the agent
    • output: The final output from the agent
    • session_id: Identifier for the conversation session
    • intermediate_steps: List of steps taken during execution
    • steps: Reformatted list of steps with detailed execution info
    • executionStats: Statistics about the execution
    • critiques: Any critiques or feedback

Returns:

  • AgentResponseData - A new instance populated with the dictionary data.

to_dict

def to_dict() -> Dict[str, Any]

[view_source]

Convert the response data to a dictionary representation.

Returns:

Dict[str, Any]: A dictionary containing all response data with keys:

  • input: The input provided to the agent
  • output: The final output from the agent
  • session_id: Identifier for the conversation session
  • intermediate_steps: List of steps taken during execution
  • steps: Reformatted list of steps with detailed execution info
  • executionStats: Statistics about the execution
  • execution_stats: Alias for executionStats
  • critiques: Any critiques or feedback

get

def get(key: str, default: Optional[Any] = None) -> Any

[view_source]

Get an attribute value using attribute-style access.

Arguments:

  • key str - The name of the attribute to get.
  • default Optional[Any], optional - The value to return if the attribute is not found. Defaults to None.

Returns:

  • Any - The value of the attribute, or the default value if not found.

__getitem__

def __getitem__(key: str) -> Any

[view_source]

Get an attribute value using dictionary-style access.

Arguments:

  • key str - The name of the attribute to get.

Returns:

  • Any - The value of the attribute, or None if not found.

__setitem__

def __setitem__(key: str, value: Any) -> None

[view_source]

Set an attribute value using dictionary-style access.

Arguments:

  • key str - The name of the attribute to set.
  • value Any - The value to assign to the attribute.

Raises:

  • KeyError - If the key is not a valid attribute of the class.

__repr__

def __repr__() -> str

[view_source]

Return a string representation of the response data.

Returns:

  • str - A string showing all attributes and their values in a readable format.

__contains__

def __contains__(key: Text) -> bool

[view_source]

Check if an attribute exists using 'in' operator.

Arguments:

  • key Text - The name of the attribute to check.

Returns:

  • bool - True if the attribute exists and is accessible, False otherwise.