Defining Goals
Goals are the source of truth for agent behavior in Hive. A well-defined goal tells the agent what to achieve, not how to achieve it.Goal Components
Every goal consists of:- Identity - Unique ID and human-readable name
- Success Criteria - Measurable conditions for success
- Constraints - Boundaries the agent must respect
- Context - Additional guidance and requirements
Basic Goal Structure
Success Criteria
Success criteria define measurable outcomes. Each criterion has:id- Unique identifierdescription- Human-readable definition of successmetric- How to measure (e.g.,output_contains,output_equals,llm_judge)target- The target value or conditionweight- Relative importance (0.0 to 1.0)
Example: Multi-Criteria Goal
Metric Types
Built-in Metrics:output_equals- Exact matchoutput_contains- Substring matchoutput_matches- Regex matchoutput_count- Count itemsllm_judge- LLM evaluationcustom- Custom evaluation function
success_rate- Percentage of successful runsvalidation_pass- Boolean validation resultuser_approval- Human approval
Constraints
Constraints define boundaries. They are either:- Hard - Violation means failure
- Soft - Violation is discouraged but allowed
Constraint Structure
Real-World Examples
Context and Requirements
Provide additional context to guide the agent:Goal Lifecycle
Goals progress through states:Evaluating Success
The Goal class provides methods to check success:Example: Success Evaluation
Goal Versioning
Goals can evolve based on runtime feedback:Best Practices
Be Specific and Measurable
Be Specific and Measurable
Success criteria should be concrete and measurable. Avoid vague descriptions like “work well” - instead use “respond within 2 seconds” or “accuracy >= 95%”.
Use Weighted Criteria
Use Weighted Criteria
Assign weights to reflect relative importance. Critical criteria get higher weights (0.3-0.4), nice-to-have features get lower weights (0.1-0.2).
Start with Hard Constraints
Start with Hard Constraints
Hard constraints define non-negotiable boundaries. Start with safety, correctness, and cost constraints before adding quality constraints.
Keep Goals Declarative
Keep Goals Declarative
Goals define WHAT to achieve, not HOW. The graph structure (nodes and edges) derives from the goal.
Testing Goals
The framework generates tests from your goals:See Testing Agents for comprehensive testing workflows.
Next Steps
Node Configuration
Configure nodes that implement your goal
Testing Framework
Generate tests from success criteria