Goal-driven decomposition with GoalEngineer
Turn vague objectives into measurable criteria
When users give a broad objective like 'improve onboarding docs', agents wander unless the goal is broken into concrete success criteria. GoalEngineer configures structured decomposition with a quality threshold and maximum criteria count.
Example
from praisonai import GoalEngineer, Agent
engineer = GoalEngineer(max_criteria=3, threshold=0.85, auto_decompose=True)
planner = Agent(
name='GoalPlanner',
instructions='Break the goal into 3 short measurable criteria.',
output='silent',
)
print('GoalEngineer -> max_criteria:', engineer.config.max_criteria, '| threshold:', engineer.config.threshold)
print(planner.start('Improve SDK onboarding docs'))Example explained
- GoalEngineer(max_criteria=3, threshold=0.85, auto_decompose=True) — Limits decomposition to 3 focused criteria and requires an 85% score before marking the goal met.
- planner.start(…) — Demonstrates concrete, verifiable criteria instead of vague aspirations.
Why capping max_criteria prevents scope creep
Letting a goal planner invent 15 sub-goals turns a 30-second task into a 20-minute sprawl. Keep max_criteria between 3 and 5 for crisp, verifiable execution.
Common pitfall: unverifiable criteria
Prefer criteria that code can check ('all 4 unit tests pass', 'JSON validates against schema') over subjective adjectives ('make it really good').
Reference: documentation