aiq.agent.tool_calling_agent.agent#

Attributes#

Classes#

ToolCallAgentGraphState

State schema for the Tool Calling Agent Graph

ToolCallAgentGraph

Configurable LangGraph Tool Calling Agent. A Tool Calling Agent requires an LLM which supports tool calling.

Module Contents#

logger#
class ToolCallAgentGraphState(/, **data: Any)#

Bases: pydantic.BaseModel

State schema for the Tool Calling Agent Graph

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

messages: list[langchain_core.messages.base.BaseMessage] = None#
class ToolCallAgentGraph(
llm: langchain_core.language_models.BaseChatModel,
tools: list[langchain_core.tools.BaseTool],
callbacks: list[langchain_core.callbacks.base.AsyncCallbackHandler] = None,
detailed_logs: bool = False,
handle_tool_errors: bool = True,
)#

Bases: aiq.agent.base.BaseAgent

Configurable LangGraph Tool Calling Agent. A Tool Calling Agent requires an LLM which supports tool calling. A tool Calling Agent utilizes the tool input parameters to select the optimal tool. Supports handling tool errors. Argument “detailed_logs” toggles logging of inputs, outputs, and intermediate steps.

tool_caller#
async agent_node(state: ToolCallAgentGraphState)#
async conditional_edge(state: ToolCallAgentGraphState)#
async tool_node(state: ToolCallAgentGraphState)#
async build_graph()#