ag2-persona

PersonaAgent for AG2

Welcome to the PersonaAgent documentation!

PersonaAgent enables AG2 (AutoGen) agents to embody distinct personas through explicit role, goal, and backstory components, allowing for more authentic and consistent agent behavior.

Key Features

Installation

pip install ag2-persona

Quick Example

from ag2_persona import PersonaBuilder

# Create an expert agent using PersonaBuilder
expert = (PersonaBuilder.from_markdown("library/data_analyst.md")
          .set_name("data_analyst")
          .llm_config({"model": "gpt-4", "temperature": 0.7})
          .build())

# Use like any AG2 agent
response = expert.generate_reply(messages=[{"content": "Analyze this data"}])