A programming framework for agentic AI
remove generic from termination guide (#111)
Jack Gerritsb8239fc34580
diff --git a/python/docs/src/guides/termination-with-intervention.md b/python/docs/src/guides/termination-with-intervention.mdindex 26890d517..9c95e69c4 100644--- a/python/docs/src/guides/termination-with-intervention.md+++ b/python/docs/src/guides/termination-with-intervention.md@@ -9,7 +9,7 @@ There are many different ways to handle termination in `agnext`. Ultimately, the```pythonimport asynciofrom dataclasses import dataclass-from typing import Any, Generic, Type, TypeVar+from typing import Anyfrom agnext.application import SingleThreadedAgentRuntimefrom agnext.components import TypeRoutedAgent, message_handler@@ -43,12 +43,9 @@ class AnAgent(TypeRoutedAgent):Next, we create an InterventionHandler that will detect the termination message and act on it. This one hooks into publishes and when it encounters `Termination` it alters its internal state to indicate that termination has been requested.```python-T = TypeVar("T")+class TerminationHandler(DefaultInterventionHandler):-class TerminationHandler(Generic[T], DefaultInterventionHandler):-- def __init__(self, termination_type: Type[T]):- self.termination_type = termination_type+ def __init__(self):self.termination_value: T | None = Noneasync def on_publish(self, message: Any, *, sender: AgentId | None) -> Any:@@ -69,7 +66,7 @@ Finally, we add this handler to the runtime and use it to detect termination and```pythonasync def main() -> None:- termination_handler = TerminationHandler(Termination)+ termination_handler = TerminationHandler()runtime = SingleThreadedAgentRuntime(before_send=termination_handler)