pref0 + CrewAI

Give your CrewAI agents persistent memory of user preferences. pref0 learns from conversations and personalizes multi-agent workflows.

Quick start

python
from crewai import Agent, Task, Crew
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']} (confidence: {p['confidence']})"
        for p in prefs if p["confidence"] >= 0.5
    )

learned = get_preferences("user_abc123")

coder = Agent(
    role="Senior Developer",
    goal="Write code following user preferences",
    backstory=f"You know the user's preferences:\n{learned}",
)

task = Task(
    description="Set up a new API project",
    agent=coder,
    expected_output="Project scaffolding code",
)

crew = Crew(agents=[coder], tasks=[task])
result = crew.kickoff()

Why use pref0 with CrewAI

Per-agent personalization

Inject user preferences into individual agent backstories. Each agent in the crew respects the user's style.

Multi-agent consistency

All agents in a crew share the same learned preferences. No conflicting outputs.

Cross-session learning

Preferences persist across crew runs. The crew gets smarter with every interaction.

Zero config

No custom tools or plugins needed. Just fetch preferences and pass them to your agents.

Other integrations

Add preference learning to CrewAI

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