Agent Node

vellum.workflows.nodes.ToolCallingNode

Used to execute a repeatedly invoke a prompt with defined tools until it produces a text output.

Attributes

prompt_inputs
EntityInputsInterface

Optional inputs for variable substitution in the prompt. These inputs are used to replace:

  • Variables within Jinja blocks
  • Variable blocks in the blocks attribute

You can reference either Workflow inputs or outputs from upstream nodes.

blocks
List[PromptBlock]Required

The blocks that make up the Prompt

ml_model
strRequired

The model to use for execution (e.g., “gpt-4o”, “claude-3.5-sonnet”)

functions
Optional[List[Tool]]

The tools that a the Prompt has access to and automatically invokes on each iteration. The acceptable tool types are:

  • Callable[..., Any] - Any function callable
  • Type["BaseWorkflow"] - An Inline Subworkflow
  • DeploymentDefinition - A reference to a Vellum Workflow Deployment
parameters
Optional[PromptParameters]

Model parameters for execution. Defaults to:

max_prompt_iterations
int

The maximum number of iterations that the Tool Calling Node is allowed to call the underlying Prompt before rejecting.

Outputs

text
str

The generated text output from the last prompt execution

results
List[ChatMessage]

The array of chat messages produced over the course of the Tool Calling Node’s iterations.

Extra Context

If you are planning to move between the UI and your IDE (via vellum workflows push), you should use the following folder structure for best results:

  • workflow.py
  • inputs.py # Optional inputs for your Workflow
    • nodes/
      • init.py # Exports all of your nodes under all
      • prompt_node.py # A node (e.g. a Prompt Node)
      • templating_node.py # Another node (e.g. a Templating Node)
    • agent/
      • init.py # Your actual agent implementation is in the init.py file.
      • add.py # Function Tool
      • subtract/ # Inline Subworkflow Tool
        • init.py
        • workflow.py
        • inputs.py
        • nodes/
          • templating.py # Node for the Subworkflow Tool