Agents¶
- class ibm_watsonx_gov.agent_catalog.core.agents.AgentInterface¶
Bases:
ABC
Base interface for all agent types.
All agents must implement the invoke method.
- abstract invoke(input_data: Dict[str, Any]) Dict[str, Any] ¶
Invokes the agent with the given input and returns the output.
- Parameters:
input_data (dict) – The input payload for the agent.
- Returns:
The output from the agent.
- Return type:
dict
- class ibm_watsonx_gov.agent_catalog.core.agents.LangChainAgent(build_fn: Callable[[], AgentExecutor], **kwargs)¶
Bases:
AgentInterface
Wrapper for LangChain agents constructed using a build function defined in code.
- invoke(input_data: dict) dict ¶
Invokes the LangChain agent.
- Parameters:
input_data (dict) – The input data for the agent.
- Returns:
The result from the agent execution.
- Return type:
dict
- class ibm_watsonx_gov.agent_catalog.core.agents.LangGraphAgent(build_fn: Callable[[], Pregel], **kwargs)¶
Bases:
AgentInterface
Wrapper for LangGraph agents constructed using a build function defined in code. This class initializes and runs a LangGraph agent from a provided build function, which is expected to return a compiled LangGraph Pregel instance.
- invoke(input_data: dict) dict ¶
Invokes the LangGraph agent.
- Parameters:
input_data (dict) – The input data for the graph.
- Returns:
The result from the graph execution.
- Return type:
dict
- class ibm_watsonx_gov.agent_catalog.core.agents.RestAgent(endpoint: str, headers: dict, method='POST')¶
Bases:
AgentInterface
Wrapper for agents accessible via REST API.
- invoke(input_schema_data: dict) dict ¶
Calls the remote agent via request.
- Parameters:
input_data (dict) – The payload to send to the remote agent.
- Returns:
The JSON response from the agent.
- Return type:
dict