- harness/es.py: append-only event store + проекции (образец — кооп-портал) - harness/levels.py: уровни 1с/1м/1ч/1д, контекст ∝ масштабу - harness/scheduler.py: уровневые потоки, идемпотентные тики, absorbed-стабы - harness/isolated_runner.py + _llm_worker.py: LLM-тик в сабпроцессе (глобальный asyncio-рантайм Strands не переживает 2+ create_harness) - cli.py: init/task/tasks/status/events + requeue (написан самим минутным агентом) - 9router: отдельный ключ sk-simbiot, модель auto (glm-5.3 первым)
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
"""First-class intervention primitive for agent control.
|
|
|
|
The intervention system provides a composable way to add authorization, steering,
|
|
guardrails, and other control layers to agents. Each control layer is an
|
|
InterventionHandler that intercepts lifecycle events and returns typed decisions.
|
|
|
|
Example:
|
|
```python
|
|
from strands import Agent, InterventionHandler
|
|
from strands.interventions import Deny, Proceed
|
|
|
|
class MyAuth(InterventionHandler):
|
|
name = "my-auth"
|
|
|
|
def before_tool_call(self, event):
|
|
if not self.is_authorized(event):
|
|
return Deny(reason="not authorized")
|
|
return Proceed()
|
|
|
|
agent = Agent(interventions=[MyAuth()])
|
|
```
|
|
"""
|
|
|
|
from .actions import Confirm as Confirm
|
|
from .actions import Deny as Deny
|
|
from .actions import Guide as Guide
|
|
from .actions import InterventionAction as InterventionAction
|
|
from .actions import Proceed as Proceed
|
|
from .actions import Transform as Transform
|
|
from .handler import InterventionHandler as InterventionHandler
|
|
from .handler import OnError as OnError
|