EvoScientist 0.0.1.dev1__py3-none-any.whl → 0.0.1.dev3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- EvoScientist/EvoScientist.py +45 -13
- EvoScientist/cli.py +237 -1363
- EvoScientist/memory.py +715 -0
- EvoScientist/middleware.py +49 -4
- EvoScientist/paths.py +45 -0
- EvoScientist/skills_manager.py +392 -0
- EvoScientist/stream/__init__.py +25 -0
- EvoScientist/stream/display.py +604 -0
- EvoScientist/stream/events.py +415 -0
- EvoScientist/stream/state.py +343 -0
- EvoScientist/stream/utils.py +23 -16
- EvoScientist/tools.py +64 -0
- {evoscientist-0.0.1.dev1.dist-info → evoscientist-0.0.1.dev3.dist-info}/METADATA +106 -7
- {evoscientist-0.0.1.dev1.dist-info → evoscientist-0.0.1.dev3.dist-info}/RECORD +18 -12
- evoscientist-0.0.1.dev3.dist-info/entry_points.txt +5 -0
- evoscientist-0.0.1.dev1.dist-info/entry_points.txt +0 -2
- {evoscientist-0.0.1.dev1.dist-info → evoscientist-0.0.1.dev3.dist-info}/WHEEL +0 -0
- {evoscientist-0.0.1.dev1.dist-info → evoscientist-0.0.1.dev3.dist-info}/licenses/LICENSE +0 -0
- {evoscientist-0.0.1.dev1.dist-info → evoscientist-0.0.1.dev3.dist-info}/top_level.txt +0 -0
EvoScientist/EvoScientist.py
CHANGED
|
@@ -22,10 +22,16 @@ from deepagents.backends import FilesystemBackend, CompositeBackend
|
|
|
22
22
|
from langchain.chat_models import init_chat_model
|
|
23
23
|
|
|
24
24
|
from .backends import CustomSandboxBackend, MergedReadOnlyBackend
|
|
25
|
-
from .middleware import create_skills_middleware
|
|
25
|
+
from .middleware import create_skills_middleware, create_memory_middleware
|
|
26
26
|
from .prompts import RESEARCHER_INSTRUCTIONS, get_system_prompt
|
|
27
27
|
from .utils import load_subagents
|
|
28
|
-
from .tools import tavily_search, think_tool
|
|
28
|
+
from .tools import tavily_search, think_tool, skill_manager
|
|
29
|
+
from .paths import (
|
|
30
|
+
ensure_dirs,
|
|
31
|
+
default_workspace_dir,
|
|
32
|
+
MEMORY_DIR as _MEMORY_DIR_PATH,
|
|
33
|
+
USER_SKILLS_DIR as _USER_SKILLS_DIR_PATH,
|
|
34
|
+
)
|
|
29
35
|
|
|
30
36
|
# =============================================================================
|
|
31
37
|
# Configuration
|
|
@@ -39,8 +45,11 @@ MAX_CONCURRENT = 3 # Max parallel sub-agents
|
|
|
39
45
|
MAX_ITERATIONS = 3 # Max delegation rounds
|
|
40
46
|
|
|
41
47
|
# Workspace settings
|
|
42
|
-
|
|
48
|
+
ensure_dirs()
|
|
49
|
+
WORKSPACE_DIR = str(default_workspace_dir())
|
|
50
|
+
MEMORY_DIR = str(_MEMORY_DIR_PATH) # Shared across sessions (not per-session)
|
|
43
51
|
SKILLS_DIR = str(Path(__file__).parent / "skills")
|
|
52
|
+
USER_SKILLS_DIR = str(_USER_SKILLS_DIR_PATH)
|
|
44
53
|
SUBAGENTS_CONFIG = Path(__file__).parent / "subagent.yaml"
|
|
45
54
|
|
|
46
55
|
# =============================================================================
|
|
@@ -76,16 +85,25 @@ else:
|
|
|
76
85
|
virtual_mode=True,
|
|
77
86
|
)
|
|
78
87
|
|
|
79
|
-
# Skills backend: merge user-installed (
|
|
88
|
+
# Skills backend: merge user-installed (./skills/) and system (package) skills
|
|
80
89
|
_skills_backend = MergedReadOnlyBackend(
|
|
81
|
-
primary_dir=
|
|
90
|
+
primary_dir=USER_SKILLS_DIR, # user-installed, takes priority
|
|
82
91
|
secondary_dir=SKILLS_DIR, # package built-in, fallback
|
|
83
92
|
)
|
|
84
93
|
|
|
85
|
-
#
|
|
94
|
+
# Memory backend: persistent filesystem for long-term memory (shared across sessions)
|
|
95
|
+
_memory_backend = FilesystemBackend(
|
|
96
|
+
root_dir=MEMORY_DIR,
|
|
97
|
+
virtual_mode=True,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
# Composite backend: workspace as default, skills and memory mounted
|
|
86
101
|
backend = CompositeBackend(
|
|
87
102
|
default=_workspace_backend,
|
|
88
|
-
routes={
|
|
103
|
+
routes={
|
|
104
|
+
"/skills/": _skills_backend,
|
|
105
|
+
"/memory/": _memory_backend,
|
|
106
|
+
},
|
|
89
107
|
)
|
|
90
108
|
|
|
91
109
|
tool_registry = {
|
|
@@ -107,10 +125,13 @@ subagents = load_subagents(
|
|
|
107
125
|
_AGENT_KWARGS = dict(
|
|
108
126
|
name="EvoScientist",
|
|
109
127
|
model=chat_model,
|
|
110
|
-
tools=[think_tool],
|
|
128
|
+
tools=[think_tool, skill_manager],
|
|
111
129
|
backend=backend,
|
|
112
130
|
subagents=subagents,
|
|
113
|
-
middleware=[
|
|
131
|
+
middleware=[
|
|
132
|
+
create_memory_middleware(MEMORY_DIR, extraction_model=chat_model),
|
|
133
|
+
create_skills_middleware(SKILLS_DIR, user_skills_dir=USER_SKILLS_DIR),
|
|
134
|
+
],
|
|
114
135
|
system_prompt=SYSTEM_PROMPT,
|
|
115
136
|
)
|
|
116
137
|
|
|
@@ -124,7 +145,7 @@ def create_cli_agent(workspace_dir: str | None = None):
|
|
|
124
145
|
Args:
|
|
125
146
|
workspace_dir: Optional per-session workspace directory. If provided,
|
|
126
147
|
creates a fresh backend rooted at this path. If None, uses the
|
|
127
|
-
module-level default backend (./workspace
|
|
148
|
+
module-level default backend (./workspace).
|
|
128
149
|
"""
|
|
129
150
|
from langgraph.checkpoint.memory import InMemorySaver # type: ignore[import-untyped]
|
|
130
151
|
|
|
@@ -135,14 +156,25 @@ def create_cli_agent(workspace_dir: str | None = None):
|
|
|
135
156
|
timeout=300,
|
|
136
157
|
)
|
|
137
158
|
sk_backend = MergedReadOnlyBackend(
|
|
138
|
-
primary_dir=
|
|
159
|
+
primary_dir=USER_SKILLS_DIR,
|
|
139
160
|
secondary_dir=SKILLS_DIR,
|
|
140
161
|
)
|
|
162
|
+
# Memory always uses SHARED directory (not per-session) for cross-session persistence
|
|
163
|
+
mem_backend = FilesystemBackend(
|
|
164
|
+
root_dir=MEMORY_DIR,
|
|
165
|
+
virtual_mode=True,
|
|
166
|
+
)
|
|
141
167
|
be = CompositeBackend(
|
|
142
168
|
default=ws_backend,
|
|
143
|
-
routes={
|
|
169
|
+
routes={
|
|
170
|
+
"/skills/": sk_backend,
|
|
171
|
+
"/memory/": mem_backend,
|
|
172
|
+
},
|
|
144
173
|
)
|
|
145
|
-
mw = [
|
|
174
|
+
mw = [
|
|
175
|
+
create_memory_middleware(MEMORY_DIR, extraction_model=chat_model),
|
|
176
|
+
create_skills_middleware(SKILLS_DIR, user_skills_dir=USER_SKILLS_DIR),
|
|
177
|
+
]
|
|
146
178
|
kwargs = dict(
|
|
147
179
|
_AGENT_KWARGS,
|
|
148
180
|
backend=be,
|