Files

30 lines
967 B
Python
Raw Permalink Normal View History

"""Base agent interface: identity, role, objective, memory/tool scope, handle_message."""
from abc import ABC, abstractmethod
from typing import Any
from fusionagi.schemas.messages import AgentMessageEnvelope
class BaseAgent(ABC):
"""Abstract base agent: identity, role, objective, memory access, tool permissions."""
def __init__(
self,
identity: str,
role: str,
objective: str,
memory_access: bool | str = True,
tool_permissions: list[str] | str | None = None,
) -> None:
self.identity = identity
self.role = role
self.objective = objective
self.memory_access = memory_access
self.tool_permissions = tool_permissions if tool_permissions is not None else []
@abstractmethod
def handle_message(self, envelope: AgentMessageEnvelope) -> AgentMessageEnvelope | None:
"""Process an incoming message; return response envelope or None."""
...