- 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 первым)
53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
"""Tool provider interface."""
|
|
|
|
from abc import ABC, abstractmethod
|
|
from collections.abc import Sequence
|
|
from typing import TYPE_CHECKING, Any
|
|
|
|
if TYPE_CHECKING:
|
|
from ..types.tools import AgentTool
|
|
|
|
|
|
class ToolProvider(ABC):
|
|
"""Interface for providing tools with lifecycle management.
|
|
|
|
Provides a way to load a collection of tools and clean them up
|
|
when done, with lifecycle managed by the agent.
|
|
"""
|
|
|
|
@abstractmethod
|
|
async def load_tools(self, **kwargs: Any) -> Sequence["AgentTool"]:
|
|
"""Load and return the tools in this provider.
|
|
|
|
Args:
|
|
**kwargs: Additional arguments for future compatibility.
|
|
|
|
Returns:
|
|
List of tools that are ready to use.
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def add_consumer(self, consumer_id: Any, **kwargs: Any) -> None:
|
|
"""Add a consumer to this tool provider.
|
|
|
|
Args:
|
|
consumer_id: Unique identifier for the consumer.
|
|
**kwargs: Additional arguments for future compatibility.
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def remove_consumer(self, consumer_id: Any, **kwargs: Any) -> None:
|
|
"""Remove a consumer from this tool provider.
|
|
|
|
This method must be idempotent - calling it multiple times with the same ID
|
|
should have no additional effect after the first call.
|
|
|
|
Provider may clean up resources when no consumers remain.
|
|
|
|
Args:
|
|
consumer_id: Unique identifier for the consumer.
|
|
**kwargs: Additional arguments for future compatibility.
|
|
"""
|
|
pass
|