Skip to contents

Builds a single-agent graph with state management and checkpointing. Tool calling is handled internally by ellmer's Chat class during $chat(), so no separate tool dispatch node is needed.

react_graph() was renamed to graph_react() in version 0.2.0 and is now deprecated.

Usage

graph_react(agent, max_iterations = 10L)

react_graph(...)

Arguments

agent

An Agent object.

max_iterations

Integer safety cap.

...

Arguments passed to graph_react().

Value

A compiled AgentGraph object.

Details

Tools should be registered on the agent at construction time via agent(tools = ...) rather than passed here.

See also

Other agents: agent()

Other convenience: graph_pipeline(), graph_supervisor()

Examples

if (FALSE) { # \dontrun{
chat <- ellmer::chat_openai(model = "gpt-4o")
a <- agent("assistant", chat)
graph <- graph_react(a)
graph$invoke(list(messages = list("Hello")))
} # }