IntelligenceProviderInterface
Interface for Intelligence Providers. Intelligence Providers analyze tool execution context and generate enriched information (suggestions, warnings, next actions, etc.) that helps the LLM make better decisions. Providers can run in two phases: - Pre-execution: Before the tool runs (for warnings, would_block) - Post-execution: After the tool runs (for suggestions, next_actions)
IntelligenceProviderInterface::getName()
abstract public function getName(): stringGet provider name for identification and debugging.
Returns
Unique provider name (e.g., "entity_completeness", "next_actions")
IntelligenceProviderInterface::supports()
abstract public function supports(Milpa\ToolRuntime\Contracts\IntelligenceContext $context): boolCheck if this provider applies to the given context. Use this to filter providers by: - Tool name patterns (e.g., only for create_* tools) - Entity types (e.g., only for Note entities) - Execution phase (e.g., only post-execution)
Parameters
| Name | Type | Description |
|---|---|---|
| $context | IntelligenceContext | The execution context |
Returns
True if this provider should run
IntelligenceProviderInterface::provide()
abstract public function provide(Milpa\ToolRuntime\Contracts\IntelligenceContext $context): Milpa\ToolRuntime\Contracts\ToolIntelligenceGenerate intelligence for the given context. Called by the IntelligenceAggregator when supports() returns true. Should return a ToolIntelligence with relevant information.
Parameters
| Name | Type | Description |
|---|---|---|
| $context | IntelligenceContext | The execution context |
Returns
The generated intelligence
IntelligenceProviderInterface::getPriority()
abstract public function getPriority(): intGet provider priority. Higher priority providers run first and their output can influence later providers. Recommended ranges: - 100+: Core providers (completeness, business rules) - 50-99: Standard providers (next actions, suggestions) - 0-49: Custom/plugin providers
Returns
Priority value (higher = runs first)
IntelligenceProviderInterface::getPhase()
abstract public function getPhase(): stringGet the execution phase for this provider. - "pre": Runs before tool execution (for warnings, would_block) - "post": Runs after tool execution (for suggestions, next_actions, context) - "both": Runs in both phases
Returns
One of: "pre", "post", "both"