pipelines.agent.base
Agent
Agent (llm:onprem.llm.base.LLM, agent_type:str='tool_calling', max_steps:int=20, tools:dict={}, **kwargs)
*Pipeline for agent-based task execution using smolagents. Extra kwargs are supplied directly to agent instantation.
Args: llm (LLM): An onprem LLM instance to use for agent reasoning agent_type (str, optional): Type of agent to use (‘tool_calling’ or ‘code’) max_steps (int, optional): Maximum number of steps the agent can take tools (dict, optional): a dictionary of tools for agent to use*
Agent.add_tool
Agent.add_tool (name:str, tool_instance)
*Add a tool to the agent.
Args: name (str): The name of the tool tool_instance (Tool): The tool instance*
Type | Details | |
---|---|---|
name | str | |
tool_instance | tool_instance is SA_Tool |
Agent.add_function_tool
Agent.add_function_tool (func:Callable)
*Create a tool from a function and its documentation.
Args: func (Callable): The function to wrap as a tool name (str, optional): The name of the tool (defaults to function name) description (str, optional): The description of the tool (defaults to function docstring)
Returns: Tool: The created tool*
Agent.add_vectorstore_tool
Agent.add_vectorstore_tool (name:str, store:onprem.ingest.base.VectorStore, description:str='Search a vector database for relevant information')
*Create a tool from a VectorStore instance.
Args: name (str): The name of the vector store tool store (VectorStore): The vector store instance description (str, optional): The description of the vector store
Returns: Tool: The created tool*
Agent.add_websearch_tool
Agent.add_websearch_tool ()
*Create a tool to perform Web searches.
Returns: Tool: The created tool*
Agent.add_webview_tool
Agent.add_webview_tool ()
*Create a tool to visit Web page
Returns: Tool: The created tool*
Agent.add_python_tool
Agent.add_python_tool ()
*Create a tool to access Python interpreter
Returns: Tool: The created tool*
Agent.add_mcp_tool
Agent.add_mcp_tool (url:str)
Add tool to access MCP server
Agent.run
Agent.run (task:str)
*Run the agent on a given task.
Args: task (str): The task description
Returns: str: The agent’s response*