Quality Checking
Automatic quality assessment for task outputs with memory storage
Tasks with quality_check=True score outputs and store high-quality results in memory.
from praisonaiagents import Agent, Task, AgentTeam, Memory
agent = Agent(
name="Writer",
instructions="Write clear, complete articles.",
memory=Memory(),
)
task = Task(
description="Write a short article on AI ethics",
expected_output="Introduction, three sections, and conclusion",
agent=agent,
quality_check=True,
)
AgentTeam(agents=[agent], tasks=[task]).start()The user runs a team task; quality scoring decides whether outputs land in long-term memory.
How It Works
Quick Start
- Simple Usage
Enable quality checking on a task (default is
True):python from praisonaiagents import Agent, Task, AgentTeam, Memory agent = Agent(name="Writer", instructions="Be thorough.", memory=Memory()) task = Task( description="Explain quantum computing in plain English", expected_output="500-word explanation with examples", agent=agent, quality_check=True, ) AgentTeam(agents=[agent], tasks=[task]).start() - With Configuration
Disable for fast runs or use execution presets:
python from praisonaiagents import Agent, Task, AgentTeam agent = Agent(name="Draft", instructions="Quick drafts only.") task = Task( description="Draft a tweet", agent=agent, quality_check=False, ) AgentTeam(agents=[agent], tasks=[task]).start()
How It Works
When quality_check=True and memory is configured:
- Agent completes the task
Memory.calculate_quality_metrics()scores completeness, relevance, clarity, accuracy via LLMfinalize_task_output()stores in long-term memory only when score exceeds 0.7- Quality metadata attaches to the task result
Memory is required — without it, quality checking logs a warning and skips storage.
Endpoint and Key Resolution
Memory.calculate_quality_metrics() picks its scoring endpoint and key from the memory config, so quality scoring reaches the same host you point memory at.
| Path | Endpoint | Key |
|---|---|---|
| litellm (default when installed) | api_base ← config base_url (or OPENAI_BASE_URL / OPENAI_API_BASE) | api_key ← config api_key (or OPENAI_API_KEY) |
| openai (fallback) | base_url ← config base_url (or OPENAI_BASE_URL) | api_key ← config api_key (or OPENAI_API_KEY) |
Config keys are read from the top level or a nested "config" dict, e.g. Memory(config={"base_url": ..., "api_key": ...}).
from praisonaiagents import Memory
memory = Memory(config={
"base_url": "https://api.groq.com/openai/v1",
"api_key": "gsk_...",
})Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
quality_check | bool | True | Enable LLM quality assessment |
expected_output | str | None | Benchmark for scoring (strongly recommended) |
memory | Memory | None | Required for quality storage |
Execution presets: "fast" disables quality check; "balanced" and "thorough" enable it.
Best Practices
Always set expected_output
Clear expectations produce meaningful scores — vague tasks score inconsistently.
Configure memory first
Quality checking stores to memory — attach memory=Memory() to the agent or task.
Disable for drafts
Set quality_check=False on brainstorming or speed-critical tasks.
Retrieve high-quality history
Search with min_quality=0.7 to reuse past strong outputs as context.