import typing

class PyAgent:
    def __new__(cls, /, *_args, **_kwargs) -> None: ...
    def act(self, /, action_name: str, inputs: typing.Any) -> typing.Any: ...
    def get_last_response(self, /) -> typing.Any: ...
    def name(self, /) -> str: ...
    def set_last_response(self, /, response: str | None) -> None: ...

class PyAgentContext:
    def __new__(cls, /, mesh_name: str) -> None: ...
    @property
    def mesh_name(self, /) -> str: ...

class PyAgentMessageProcessor:
    @property
    def agent_name(self, /) -> str: ...
    def has_pending(self, /) -> bool: ...
    def pending_count(self, /) -> int: ...
    def process_pending(self, /) -> int: ...

class PyAgentMetadata:
    def __new__(cls, /, id: str, name: str, address: str) -> None: ...
    @property
    def address(self, /) -> str: ...
    @property
    def id(self, /) -> str: ...
    @property
    def name(self, /) -> str: ...

class PyDistributedMesh:
    def __new__(cls, /, name: str, port: int) -> None: ...
    def add_agent(self, /, agent: PyAgent) -> PyAgentMessageProcessor: ...
    def add_llm_agent(self, /, agent: PyLlmAgent) -> str: ...
    def broadcast(self, /, payload: str, exclude: str | None = None) -> typing.Any: ...
    def collect_results(self, /, reminder_interval: float = 30.0) -> typing.Any: ...
    def collect_results_sync(self, /, reminder_interval: float = 30.0) -> typing.Any: ...
    def connect_peer(self, /, agent_name: str, url: str) -> typing.Any: ...
    def get_pending(self, /) -> typing.Any: ...
    def get_results(self, /) -> typing.Any: ...
    def has_pending(self, /) -> bool: ...
    def peek_results(self, /) -> typing.Any: ...
    def process_messages(self, /) -> int: ...
    def query(self, /, target: str, payload: str, timeout: float = 60.0, reminder_interval: float = 30.0) -> typing.Any: ...
    def query_sync(self, /, target: str, payload: str, timeout: float = 60.0, reminder_interval: float = 30.0) -> PyMeshResult: ...
    def send_reminders(self, /, older_than_secs: float = 30.0) -> typing.Any: ...
    def send_to(self, /, target: str, payload: str) -> typing.Any: ...
    def send_to_sync(self, /, target: str, payload: str) -> typing.Any: ...
    def start(self, /) -> typing.Any: ...
    def stop(self, /) -> typing.Any: ...
    def submit(self, /, target: str, payload: str) -> typing.Any: ...
    def submit_sync(self, /, target: str, payload: str) -> str: ...
    def wait_for(self, /, request_id: str, timeout: float = 60.0, reminder_interval: float = 30.0) -> typing.Any: ...
    def wait_for_sync(self, /, request_id: str, timeout: float = 60.0, reminder_interval: float = 30.0) -> PyMeshResult: ...
    @staticmethod
    def with_registry(name: str, port: int, registry: PyInMemoryRegistry) -> PyDistributedMesh: ...

class PyInMemoryBackend:
    def __new__(cls, /) -> None: ...
    def __repr__(self, /) -> str: ...
    def clear(self, /) -> typing.Any: ...
    def count(self, /) -> int: ...
    def delete(self, /, id: str) -> bool: ...
    def get(self, /, id: str) -> typing.Any: ...
    def search(self, /, query: PyMemoryQuery) -> typing.Any: ...
    def store(self, /, entry: PyMemoryEntry) -> str: ...
    @staticmethod
    def with_max_entries(max: int) -> PyInMemoryBackend: ...
    @staticmethod
    def with_ttl_seconds(seconds: int) -> PyInMemoryBackend: ...

class PyInMemoryRegistry:
    def __new__(cls, /) -> None: ...
    def get_agent(self, /, agent_id: str) -> typing.Any: ...
    def register(self, /, metadata: PyAgentMetadata) -> typing.Any: ...

class PyLlmAgent:
    def __new__(cls, /, name: str, model: str) -> None: ...
    def add_action(self, /, action: _PyAction) -> PyLlmAgent: ...
    def add_tool(self, /, action: _PyAction) -> PyLlmAgent: ...
    def build(self, /) -> PyLlmAgent: ...
    def is_built(self, /) -> bool: ...
    def query(self, /, message: str) -> typing.Any: ...
    def register_action(self, /, action: _PyAction) -> typing.Any: ...
    def send_message(self, /, message: str) -> typing.Any: ...
    def send_message_react(self, /, message: str) -> PyReActResult: ...
    def send_message_sync(self, /, message: str) -> str: ...
    def with_api_key(self, /, api_key: str) -> PyLlmAgent: ...
    @staticmethod
    def with_config(name: str, config: PyLlmConfig) -> PyLlmAgent: ...
    def with_max_tokens(self, /, max_tokens: int) -> PyLlmAgent: ...
    def with_memory(self, /, memory: typing.Any) -> PyLlmAgent: ...
    def with_react(self, /, config: PyReActConfig) -> typing.Any: ...
    def with_system_prompt(self, /, prompt: str) -> PyLlmAgent: ...
    def with_temperature(self, /, temperature: float) -> PyLlmAgent: ...

class PyLlmConfig:
    def base_url(self, /, base_url: str) -> PyLlmConfig: ...
    def build(self, /) -> PyLlmConfig: ...
    @staticmethod
    def builder() -> PyLlmConfig: ...
    def max_tokens(self, /, max_tokens: int) -> PyLlmConfig: ...
    def model(self, /, model: str) -> PyLlmConfig: ...
    def provider(self, /, provider: str) -> PyLlmConfig: ...
    def temperature(self, /, temperature: float) -> PyLlmConfig: ...

class PyLocalMesh:
    def __new__(cls, /, name: str) -> None: ...
    def add_agent(self, /, agent: PyAgent) -> PyAgentMessageProcessor: ...
    def add_llm_agent(self, /, agent: PyLlmAgent) -> str: ...
    def broadcast(self, /, payload: str, exclude: str | None = None) -> typing.Any: ...
    def collect_results(self, /, reminder_interval: float = 30.0) -> typing.Any: ...
    def collect_results_sync(self, /, reminder_interval: float = 30.0) -> typing.Any: ...
    def get_pending(self, /) -> typing.Any: ...
    def get_results(self, /) -> typing.Any: ...
    def has_pending(self, /) -> bool: ...
    def peek_results(self, /) -> typing.Any: ...
    def process_messages(self, /) -> int: ...
    def query(self, /, target: str, payload: str, timeout: float = 60.0, reminder_interval: float = 30.0) -> typing.Any: ...
    def query_sync(self, /, target: str, payload: str, timeout: float = 60.0, reminder_interval: float = 30.0) -> PyMeshResult: ...
    def send_reminders(self, /, older_than_secs: float = 30.0) -> typing.Any: ...
    def send_to(self, /, target: str, payload: str) -> typing.Any: ...
    def send_to_sync(self, /, target: str, payload: str) -> typing.Any: ...
    def start(self, /) -> typing.Any: ...
    def submit(self, /, target: str, payload: str) -> typing.Any: ...
    def submit_sync(self, /, target: str, payload: str) -> str: ...
    def wait_for(self, /, request_id: str, timeout: float = 60.0, reminder_interval: float = 30.0) -> typing.Any: ...
    def wait_for_sync(self, /, request_id: str, timeout: float = 60.0, reminder_interval: float = 30.0) -> PyMeshResult: ...

class PyLoggingConfig:
    def __new__(cls, /, log_level: str, log_file_path: str | None, json_output: bool) -> None: ...

class PyLoggingHandle: ...

class PyMemoryEntry:
    def __new__(cls, /, content: str) -> None: ...
    def __repr__(self, /) -> str: ...
    @property
    def content(self, /) -> str: ...
    @property
    def created_at(self, /) -> str: ...
    @property
    def expires_at(self, /) -> typing.Any: ...
    @property
    def id(self, /) -> str: ...
    def is_expired(self, /) -> bool: ...
    @property
    def metadata(self, /) -> typing.Any: ...
    def with_metadata(self, /, key: str, value: typing.Any) -> PyMemoryEntry: ...
    def with_ttl_seconds(self, /, seconds: int) -> PyMemoryEntry: ...

class PyMemoryQuery:
    def __new__(cls, /) -> None: ...
    def __repr__(self, /) -> str: ...
    def with_filter(self, /, key: str, value: typing.Any) -> PyMemoryQuery: ...
    def with_limit(self, /, limit: int) -> PyMemoryQuery: ...

class PyMeshRequest:
    def __repr__(self, /) -> str: ...
    @property
    def elapsed_seconds(self, /) -> float: ...
    @property
    def id(self, /) -> str: ...
    @property
    def payload(self, /) -> str: ...
    @property
    def reminder_count(self, /) -> int: ...
    @property
    def target(self, /) -> str: ...

class PyMeshResult:
    def __repr__(self, /) -> str: ...
    @property
    def duration_ms(self, /) -> int: ...
    @property
    def request_id(self, /) -> str: ...
    @property
    def response(self, /) -> str: ...
    @property
    def target(self, /) -> str: ...

class PyReActConfig:
    def __new__(cls, /) -> None: ...
    def with_action_prefix(self, /, prefix: str) -> PyReActConfig: ...
    def with_max_iterations(self, /, max_iterations: int) -> PyReActConfig: ...
    def with_thought_prefix(self, /, prefix: str) -> PyReActConfig: ...

class PyReActResult:
    def __repr__(self, /) -> str: ...
    @property
    def answer(self, /) -> str: ...
    @property
    def finish_reason(self, /) -> str: ...
    def get_steps(self, /) -> typing.Any: ...
    @property
    def iterations(self, /) -> int: ...
    def print_trace(self, /) -> None: ...

class PyReActStep:
    def __repr__(self, /) -> str: ...
    @property
    def action(self, /) -> typing.Any: ...
    @property
    def action_input(self, /) -> typing.Any: ...
    @property
    def iteration(self, /) -> int: ...
    @property
    def observation(self, /) -> typing.Any: ...
    @property
    def thought(self, /) -> str: ...

class PyRedisBackend:
    def __new__(cls, /, redis_url: str) -> None: ...
    def __repr__(self, /) -> str: ...
    def clear(self, /) -> typing.Any: ...
    def count(self, /) -> int: ...
    def delete(self, /, id: str) -> bool: ...
    def get(self, /, id: str) -> typing.Any: ...
    def search(self, /, query: PyMemoryQuery) -> typing.Any: ...
    def store(self, /, entry: PyMemoryEntry) -> str: ...
    def with_prefix(self, /, prefix: str) -> PyRedisBackend: ...
    def with_ttl_seconds(self, /, seconds: int) -> PyRedisBackend: ...

class PyToolInvoker:
    def __new__(cls, /) -> None: ...
    def invoke(self, /, name: str, inputs: str) -> str: ...
    def register(self, /, action: _PyAction) -> typing.Any: ...

class _PyAction:
    def __new__(cls, /, name: str, description: str, input_schema: str, output_schema: str | None = None) -> None: ...
    def execute(self, /, _context: PyAgentContext, _inputs: typing.Any) -> typing.Any: ...
    def metadata(self, /) -> str: ...

def get_metrics() -> typing.Any: ...
def init_logging_py(config: PyLoggingConfig) -> PyLoggingHandle: ...
