haive.core.common.mixins.recompile_mixin¶
Recompilation mixin for agents and engines that need dynamic recompilation.
This mixin provides standardized recompilation tracking and management for components that can be dynamically updated (agents, engines, graphs).
Classes¶
Mixin that adds recompilation tracking to agents and engines. |
Module Contents¶
- class haive.core.common.mixins.recompile_mixin.RecompileMixin[source]¶
Mixin that adds recompilation tracking to agents and engines.
This mixin provides: - Recompilation need tracking - Recompilation history - Reason logging for recompilation events - Automatic recompilation status management
Components that inherit from this mixin can track when they need to be recompiled due to changes in tools, schemas, or other configuration updates.
Examples
from haive.core.mixins.recompile_mixin import RecompileMixin from haive.agents.base.agent import Agent
- class MyAgent(Agent, RecompileMixin):
- def update_tools(self, new_tools):
self.tools = new_tools self.mark_for_recompile(“Tools updated”)
- def compile_if_needed(self):
- if self.needs_recompile:
self.rebuild_graph() self.resolve_recompile()
- add_recompile_trigger(condition_func, reason)[source]¶
Add a condition that triggers recompilation.
- Parameters:
condition_func (callable) – Function that returns True if recompilation needed
reason (str) – Reason to log if condition is met
- Return type:
None
- check_recompile_conditions()[source]¶
Check if any recompilation conditions are met.
This method should be overridden by subclasses to implement specific recompilation condition checking.
- Returns:
True if recompilation is needed
- Return type:
- clear_recompile_history(keep_recent=10)[source]¶
Clear recompilation history, optionally keeping recent entries.
- Parameters:
keep_recent (int) – Number of recent entries to keep (0 = clear all)
- Return type:
None
- force_recompile(reason='Manual force recompile')[source]¶
Force immediate recompilation regardless of current state.
- Parameters:
reason (str) – Reason for forcing recompilation
- Return type:
None