CreateAgent vs CreateReactAgent

LangGraphGo provides two ways to build prebuilt agents: CreateAgent and CreateReactAgent. While both create ReAct-based agents, they differ in flexibility and configuration options.

1. CreateReactAgent

Introduction

CreateReactAgent is the most basic builder. It is designed to quickly start a ReAct Agent with minimal configuration.

Features

Code Example

// Only requires model and tools
agent, err := prebuilt.CreateReactAgent(model, tools)

2. CreateAgent

Introduction

CreateAgent is a more advanced and flexible builder. It uses the Option pattern common in Go, allowing fine-grained control over Agent behavior.

Configuration Options

Use Cases

Code Example

// Configure using Option pattern
agent, err := prebuilt.CreateAgent(
    model, 
    tools,
    prebuilt.WithSystemMessage("You are a professional Golang programming assistant."),
    prebuilt.WithCheckpointer(checkpointer),
)

3. Comparison Summary

Feature CreateReactAgent CreateAgent
Configuration Flexibility Low High
System Prompt Not Supported Supported (WithSystemMessage)
State Persistence Not Supported (Default) Supported (WithCheckpointer)
Recommended Use Simple Testing, Prototyping Production, Complex Apps