Skip to main content
A system message is a message that sets the default behavior and personality for your agents. You can add it to the history as the first message to influence the behavior of the agent.

Basic Usage

final agent = Agent('openai');

// Use default assistant
final result1 = await agent.send(
  'Hello!',
  history: [ChatMessage.system('You are a helpful assistant.')],
);
// Response: "Hello! How can I help you today?"

// Use pirate personality
final result2 = await agent.send(
  'Hello!',
  history: [ChatMessage.system('You are a pirate. Speak like one.')],
);
// Response: "Ahoy, matey!"

Examples

Next Steps