pref0 + AutoGen

Add preference learning to Microsoft AutoGen agents. pref0 extracts preferences from multi-agent conversations and personalizes future sessions.

Quick start

python
from autogen import ConversableAgent
import requests

PREF0_API = "https://api.pref0.com"
PREF0_KEY = "pref0_sk_..."

def get_preferences(user_id: str) -> str:
    res = requests.get(
        f"{PREF0_API}/v1/profiles/{user_id}",
        headers={"Authorization": f"Bearer {PREF0_KEY}"},
    )
    prefs = res.json().get("preferences", [])
    return "\n".join(
        f"- {p['key']}: {p['value']}"
        for p in prefs if p["confidence"] >= 0.5
    )

learned = get_preferences("user_abc123")

assistant = ConversableAgent(
    name="assistant",
    system_message=f"You are a helpful assistant.\n\nLearned preferences:\n{learned}",
    llm_config={"model": "gpt-4o"},
)

user_proxy = ConversableAgent(
    name="user",
    human_input_mode="ALWAYS",
)

user_proxy.initiate_chat(assistant, message="Set up a new project for me")

Why use pref0 with AutoGen

System message injection

Add preferences to any ConversableAgent's system message. Works with AssistantAgent and custom agents.

Multi-agent support

Share preferences across all agents in a group chat. Consistent behavior from every agent.

Session persistence

Preferences survive across AutoGen sessions. Track conversations after each chat to keep learning.

No custom skills needed

pref0 works outside AutoGen's skill system. Simple HTTP calls before and after conversations.

Other integrations

Add preference learning to AutoGen

Your users are already teaching your agent what they want. pref0 makes sure the lesson sticks.