Skip to contents

Convert an Agent to a graph node handler function

Usage

as_node(agent, input_key = "messages", output_key = "messages")

Arguments

agent

An Agent object.

input_key

State key containing the input prompt (default "messages").

output_key

State key for the response (default "messages").

Value

A function suitable for use as a graph node handler.

See also

Examples

if (FALSE) { # \dontrun{
chat <- ellmer::chat_openai(model = "gpt-4o")
a <- agent("helper", chat)
handler <- as_node(a)
} # }