Node¶
Classes¶
- class arshai.workflows.node.BaseNode(node_id, name, agent, node_config=None, **kwargs)[source]¶
Bases:
INodeBase implementation of the INode interface.
Wraps an agent and provides the node interface for workflow integration. This implementation follows the direct dependency injection pattern where the agent is provided directly rather than through Settings.
- __init__(node_id, name, agent, node_config=None, **kwargs)[source]¶
Initialize a node with an agent.
- Parameters:
Example
# Create agent first from arshai.agents.hub.working_memory import WorkingMemoryAgent from arshai.llms.openai import OpenAIClient
llm_client = OpenAIClient(config) agent = WorkingMemoryAgent(llm_client, memory_manager, “You are helpful”)
# Create node with agent node = BaseNode(
node_id=”process_user_query”, name=”Process User Query”, agent=agent, node_config={“timeout”: 30, “retries”: 3}
)
- async process(input_data)[source]¶
Process the input data using the underlying agent.
Following the workflow state pattern, this method: 1. Extracts the workflow state from input data 2. Processes the input using the agent 3. Updates the state with the results 4. Returns the updated state and results