Files
EvoScientist/EvoScientist/__init__.py
T
dinos f2f010a350 feat(memory): observation linking (#307)
* refactor(gateway): create module for launching async/bg agents

* refactor(memory): refactor worker launch around source context & output deltas

* refactor(gateway): generalize async/bg module

* refactor(memory): revamp worker launching

* feat(memory): add observation linking

* test(memory): remove redundant test branches

* fix(memory): make 'supersedes' relation directional

* fix(memory): don't create empty project observation dirs

* fix(memory): schedule direct observations for linking

* fix(cli): wait for observation linker before shutdown

* fix(memory): block arbitrary writes to /memories

* fix(linker): remove `linked_by` attribute from frontmatter

* refactor(linker): rename base relationship to `comlpements`

* fix(cli): bump worker wait to 2m

* feat(tools): catch malformed tool calls & retry

* feat(status): add linking result to statusbar

* fix(linker): don't launch linker when observations are disabled

* fix(memory): use posix paths

* fix(watcher): call abort hook on error status

* fix(watcher): delete thread on failed run creation

* fix(watcher): preserve url

* fix(observation): record session_id, drop unused fields

* fix(memory): reject unsupported worker source types

* refactor(backends): shared memory backend builder

* fix(scheduler): resolve linker inputs outside lock

* fix(memory): dont launch workers / record observations without thread_id

* feat(memory): include related observations in tool results

* fix(memory): skip malformed observation frontmatter

* revert(tools): drop tool error handling changes from this PR

* fix(memory): serialize observation link writes

* fix(memory): queue observations written by aborted workers

* fix(memory): track observation linker launch handoff

* fix(memory): resolve cross-project related observations

* fix(status): avoid recounting reason-only link updates

* fix(memory): avoid rereading file for content

* fix(linker): use neutral prose for bidirectional reasons

* test(memory): coverage for aborted/failed launches

* test(memory): cleanup & helpers

* feat(linker): add observations index hint
2026-06-26 22:20:52 +01:00

74 lines
2.5 KiB
Python

"""EvoScientist Agent - AI-powered research and code execution.
This package exposes a convenience API at the package root while keeping
imports lazy, so lightweight modules (for example config helpers) can be used
without importing heavy runtime dependencies.
"""
from __future__ import annotations
from importlib import import_module
_EXPORTS: dict[str, tuple[str, str]] = {
# Agent graph (lazy to avoid expensive initialization at import time)
"EvoScientist_agent": (".EvoScientist", "EvoScientist_agent"),
"create_cli_agent": (".EvoScientist", "create_cli_agent"),
# Backends
"CustomSandboxBackend": (".backends", "CustomSandboxBackend"),
"MemoryFilesystemBackend": (".backends", "MemoryFilesystemBackend"),
"ReadOnlyFilesystemBackend": (".backends", "ReadOnlyFilesystemBackend"),
# Configuration
"EvoScientistConfig": (".config", "EvoScientistConfig"),
"load_config": (".config", "load_config"),
"save_config": (".config", "save_config"),
"get_effective_config": (".config", "get_effective_config"),
"get_config_path": (".config", "get_config_path"),
# LLM
"get_chat_model": (".llm", "get_chat_model"),
"MODELS": (".llm", "MODELS"),
"list_models": (".llm", "list_models"),
"DEFAULT_MODEL": (".llm", "DEFAULT_MODEL"),
# Prompts
"get_system_prompt": (".prompts", "get_system_prompt"),
# Tools
"tavily_search": (".tools", "tavily_search"),
"think_tool": (".tools", "think_tool"),
# Sessions
"get_checkpointer": (".sessions", "get_checkpointer"),
"generate_thread_id": (".sessions", "generate_thread_id"),
"list_threads": (".sessions", "list_threads"),
"delete_thread": (".sessions", "delete_thread"),
}
def __getattr__(name: str):
"""Lazily import and cache package-level attributes.
Args:
name: The attribute name to look up.
Returns:
The resolved attribute value.
Raises:
AttributeError: If the name is not in _EXPORTS.
"""
target = _EXPORTS.get(name)
if target is None:
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
module_name, attr_name = target
module = import_module(module_name, package=__name__)
value = getattr(module, attr_name)
# Cache after first load to avoid repeated import lookups.
globals()[name] = value
return value
def __dir__() -> list[str]:
"""List available public attributes including lazy exports."""
return sorted(set(globals()) | set(_EXPORTS))
__all__ = list(_EXPORTS)