zero-agent 0.1.0__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.
- agentz/agent/base.py +262 -0
- agentz/artifacts/__init__.py +5 -0
- agentz/artifacts/artifact_writer.py +538 -0
- agentz/artifacts/reporter.py +235 -0
- agentz/artifacts/terminal_writer.py +100 -0
- agentz/context/__init__.py +6 -0
- agentz/context/context.py +91 -0
- agentz/context/conversation.py +205 -0
- agentz/context/data_store.py +208 -0
- agentz/llm/llm_setup.py +156 -0
- agentz/mcp/manager.py +142 -0
- agentz/mcp/patches.py +88 -0
- agentz/mcp/servers/chrome_devtools/server.py +14 -0
- agentz/profiles/base.py +108 -0
- agentz/profiles/data/data_analysis.py +38 -0
- agentz/profiles/data/data_loader.py +35 -0
- agentz/profiles/data/evaluation.py +43 -0
- agentz/profiles/data/model_training.py +47 -0
- agentz/profiles/data/preprocessing.py +47 -0
- agentz/profiles/data/visualization.py +47 -0
- agentz/profiles/manager/evaluate.py +51 -0
- agentz/profiles/manager/memory.py +62 -0
- agentz/profiles/manager/observe.py +48 -0
- agentz/profiles/manager/routing.py +66 -0
- agentz/profiles/manager/writer.py +51 -0
- agentz/profiles/mcp/browser.py +21 -0
- agentz/profiles/mcp/chrome.py +21 -0
- agentz/profiles/mcp/notion.py +21 -0
- agentz/runner/__init__.py +74 -0
- agentz/runner/base.py +28 -0
- agentz/runner/executor.py +320 -0
- agentz/runner/hooks.py +110 -0
- agentz/runner/iteration.py +142 -0
- agentz/runner/patterns.py +215 -0
- agentz/runner/tracker.py +188 -0
- agentz/runner/utils.py +45 -0
- agentz/runner/workflow.py +250 -0
- agentz/tools/__init__.py +20 -0
- agentz/tools/data_tools/__init__.py +17 -0
- agentz/tools/data_tools/data_analysis.py +152 -0
- agentz/tools/data_tools/data_loading.py +92 -0
- agentz/tools/data_tools/evaluation.py +175 -0
- agentz/tools/data_tools/helpers.py +120 -0
- agentz/tools/data_tools/model_training.py +192 -0
- agentz/tools/data_tools/preprocessing.py +229 -0
- agentz/tools/data_tools/visualization.py +281 -0
- agentz/utils/__init__.py +69 -0
- agentz/utils/config.py +708 -0
- agentz/utils/helpers.py +10 -0
- agentz/utils/parsers.py +142 -0
- agentz/utils/printer.py +539 -0
- pipelines/base.py +972 -0
- pipelines/data_scientist.py +97 -0
- pipelines/data_scientist_memory.py +151 -0
- pipelines/experience_learner.py +0 -0
- pipelines/prompt_generator.py +0 -0
- pipelines/simple.py +78 -0
- pipelines/simple_browser.py +145 -0
- pipelines/simple_chrome.py +75 -0
- pipelines/simple_notion.py +103 -0
- pipelines/tool_builder.py +0 -0
- zero_agent-0.1.0.dist-info/METADATA +269 -0
- zero_agent-0.1.0.dist-info/RECORD +66 -0
- zero_agent-0.1.0.dist-info/WHEEL +5 -0
- zero_agent-0.1.0.dist-info/licenses/LICENSE +21 -0
- zero_agent-0.1.0.dist-info/top_level.txt +2 -0
agentz/profiles/base.py
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
import re
|
3
|
+
from typing import Optional, List, Type, Set
|
4
|
+
from pydantic import BaseModel, Field, model_validator
|
5
|
+
|
6
|
+
|
7
|
+
class ToolAgentOutput(BaseModel):
|
8
|
+
"""Standard output for all tool agents"""
|
9
|
+
output: str
|
10
|
+
sources: list[str] = Field(default_factory=list)
|
11
|
+
|
12
|
+
|
13
|
+
class Profile(BaseModel):
|
14
|
+
instructions: str = Field(description="The agent's system prompt/instructions that define its behavior")
|
15
|
+
runtime_template: str = Field(description="The runtime template for the agent's behavior")
|
16
|
+
model: Optional[str] = Field(default=None, description="Model override for this profile (e.g., 'gpt-4', 'claude-3-5-sonnet')")
|
17
|
+
output_schema: Optional[Type[BaseModel]] = Field(default=None, description="Pydantic model class for structured output validation")
|
18
|
+
input_schema: Optional[Type[BaseModel]] = Field(default=None, description="Pydantic model class for input validation")
|
19
|
+
tools: Optional[List[str]] = Field(default=None, description="List of tools to use for this profile")
|
20
|
+
|
21
|
+
class Config:
|
22
|
+
arbitrary_types_allowed = True
|
23
|
+
|
24
|
+
@model_validator(mode='after')
|
25
|
+
def validate_runtime_template_placeholders(self) -> 'Profile':
|
26
|
+
"""Validate that all placeholders in runtime_template match fields in input_schema."""
|
27
|
+
if not self.runtime_template or not self.input_schema:
|
28
|
+
return self
|
29
|
+
|
30
|
+
# Extract placeholders from runtime_template (format: [[FIELD_NAME]])
|
31
|
+
placeholder_pattern = r'\[\[([A-Z_]+)\]\]'
|
32
|
+
placeholders: Set[str] = set(re.findall(placeholder_pattern, self.runtime_template))
|
33
|
+
|
34
|
+
# Get field names from input_schema and convert to uppercase
|
35
|
+
schema_fields: Set[str] = {field_name.upper() for field_name in self.input_schema.model_fields.keys()}
|
36
|
+
|
37
|
+
# Check for mismatches
|
38
|
+
missing_in_schema = placeholders - schema_fields
|
39
|
+
|
40
|
+
if missing_in_schema:
|
41
|
+
raise ValueError(
|
42
|
+
f"Runtime template contains placeholders that don't match input_schema fields: "
|
43
|
+
f"{missing_in_schema}. Available fields in input_schema (uppercase): {schema_fields}"
|
44
|
+
)
|
45
|
+
|
46
|
+
return self
|
47
|
+
|
48
|
+
def render(self, **kwargs) -> str:
|
49
|
+
"""Render the runtime template with provided keyword arguments.
|
50
|
+
|
51
|
+
Args:
|
52
|
+
**kwargs: Values to substitute for placeholders in the template.
|
53
|
+
Keys are matched case-insensitively with [[PLACEHOLDER]] patterns.
|
54
|
+
|
55
|
+
Returns:
|
56
|
+
Rendered template string with all placeholders replaced.
|
57
|
+
|
58
|
+
Examples:
|
59
|
+
profile.render(QUERY="What is AI?", HISTORY="Previous context...")
|
60
|
+
"""
|
61
|
+
result = self.runtime_template
|
62
|
+
# Replace [[KEY]] placeholders with provided values
|
63
|
+
for key, value in kwargs.items():
|
64
|
+
placeholder = f"[[{key.upper()}]]"
|
65
|
+
result = result.replace(placeholder, str(value))
|
66
|
+
return result
|
67
|
+
|
68
|
+
|
69
|
+
def load_all_profiles():
|
70
|
+
"""Load all Profile instances from the profiles package.
|
71
|
+
|
72
|
+
Returns:
|
73
|
+
Dict with shortened keys (e.g., "observe" instead of "observe_profile")
|
74
|
+
Each profile has a _key attribute added for automatic name derivation
|
75
|
+
"""
|
76
|
+
import importlib
|
77
|
+
import inspect
|
78
|
+
from pathlib import Path
|
79
|
+
|
80
|
+
profiles = {}
|
81
|
+
package_path = Path(__file__).parent
|
82
|
+
|
83
|
+
# Recursively find all .py files in the profiles directory
|
84
|
+
for py_file in package_path.rglob('*.py'):
|
85
|
+
if py_file.name == 'base.py' or py_file.name.startswith('_'):
|
86
|
+
continue
|
87
|
+
|
88
|
+
# Convert file path to module name (need to find 'agentz' root)
|
89
|
+
# Go up from current file: profiles/base.py -> profiles -> agentz
|
90
|
+
agentz_root = package_path.parent
|
91
|
+
relative_path = py_file.relative_to(agentz_root)
|
92
|
+
module_name = 'agentz.' + str(relative_path.with_suffix('')).replace('/', '.')
|
93
|
+
|
94
|
+
try:
|
95
|
+
module = importlib.import_module(module_name)
|
96
|
+
for name, obj in inspect.getmembers(module):
|
97
|
+
if isinstance(obj, Profile) and not name.startswith('_'):
|
98
|
+
# Strip "_profile" suffix from key for cleaner access
|
99
|
+
key = name.replace('_profile', '') if name.endswith('_profile') else name
|
100
|
+
# Add _key attribute to profile for automatic name derivation
|
101
|
+
obj._key = key
|
102
|
+
profiles[key] = obj
|
103
|
+
except Exception:
|
104
|
+
pass
|
105
|
+
|
106
|
+
return profiles
|
107
|
+
|
108
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel, Field
|
4
|
+
|
5
|
+
from agentz.profiles.base import Profile, ToolAgentOutput
|
6
|
+
|
7
|
+
|
8
|
+
class TaskInput(BaseModel):
|
9
|
+
"""Input schema for task-based runtime template."""
|
10
|
+
task: str = Field(description="The task to perform")
|
11
|
+
|
12
|
+
|
13
|
+
# Profile instance for data analysis agent
|
14
|
+
data_analysis_profile = Profile(
|
15
|
+
instructions="""You are an exploratory data analysis specialist. Your task is to analyze data patterns and relationships.
|
16
|
+
|
17
|
+
Steps:
|
18
|
+
1. Use the analyze_data tool (it automatically uses the currently loaded dataset)
|
19
|
+
- If a target_column is mentioned in the task, pass it as a parameter
|
20
|
+
- The tool will analyze the dataset that was previously loaded
|
21
|
+
2. The tool returns: distributions, correlations, outliers (IQR method), patterns, recommendations
|
22
|
+
3. Write a 3+ paragraph summary covering:
|
23
|
+
- Key statistical insights (means, medians, distributions)
|
24
|
+
- Important correlations (>0.7) and relationships
|
25
|
+
- Outlier percentages and potential impact
|
26
|
+
- Data patterns and anomalies identified
|
27
|
+
- Preprocessing recommendations based on findings
|
28
|
+
|
29
|
+
Include specific numbers, correlation values, and percentages.
|
30
|
+
|
31
|
+
Output JSON only following this schema:
|
32
|
+
[[OUTPUT_SCHEMA]]""",
|
33
|
+
runtime_template="[[TASK]]",
|
34
|
+
output_schema=ToolAgentOutput,
|
35
|
+
input_schema=TaskInput,
|
36
|
+
tools=["analyze_data"],
|
37
|
+
model=None
|
38
|
+
)
|
@@ -0,0 +1,35 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel, Field
|
4
|
+
|
5
|
+
from agentz.profiles.base import Profile, ToolAgentOutput
|
6
|
+
|
7
|
+
|
8
|
+
class TaskInput(BaseModel):
|
9
|
+
"""Input schema for task-based runtime template."""
|
10
|
+
task: str = Field(description="The task to perform")
|
11
|
+
|
12
|
+
|
13
|
+
# Profile instance for data loader agent
|
14
|
+
data_loader_profile = Profile(
|
15
|
+
instructions="""You are a data loading specialist. Your task is to load and inspect datasets.
|
16
|
+
|
17
|
+
Steps:
|
18
|
+
1. Use the load_dataset tool with the provided file path
|
19
|
+
2. The tool returns: shape, columns, dtypes, missing values, sample data, statistics, memory usage, duplicates
|
20
|
+
3. Write a 2-3 paragraph summary covering:
|
21
|
+
- Dataset size and structure
|
22
|
+
- Data types and columns
|
23
|
+
- Data quality issues (missing values, duplicates)
|
24
|
+
- Key statistics and initial observations
|
25
|
+
|
26
|
+
Include specific numbers and percentages in your summary.
|
27
|
+
|
28
|
+
Output JSON only following this schema:
|
29
|
+
[[OUTPUT_SCHEMA]]""",
|
30
|
+
runtime_template="[[TASK]]",
|
31
|
+
output_schema=ToolAgentOutput,
|
32
|
+
input_schema=TaskInput,
|
33
|
+
tools=["load_dataset"],
|
34
|
+
model=None
|
35
|
+
)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel, Field
|
4
|
+
|
5
|
+
from agentz.profiles.base import Profile, ToolAgentOutput
|
6
|
+
|
7
|
+
|
8
|
+
class TaskInput(BaseModel):
|
9
|
+
"""Input schema for task-based runtime template."""
|
10
|
+
task: str = Field(description="The task to perform")
|
11
|
+
|
12
|
+
|
13
|
+
# Profile instance for evaluation agent
|
14
|
+
evaluation_profile = Profile(
|
15
|
+
instructions="""You are a model evaluation specialist. Your task is to assess model performance comprehensively.
|
16
|
+
|
17
|
+
Steps:
|
18
|
+
1. Use the evaluate_model tool (it automatically uses the currently loaded dataset)
|
19
|
+
- Required: target_column (which column was predicted)
|
20
|
+
- Optional: model_type (default: random_forest)
|
21
|
+
- The tool will evaluate on the dataset that was previously loaded/preprocessed
|
22
|
+
2. The tool returns:
|
23
|
+
- Classification: accuracy, precision, recall, F1, confusion matrix, per-class metrics, CV results
|
24
|
+
- Regression: R², RMSE, MAE, MAPE, error analysis, CV results
|
25
|
+
3. Write a 3+ paragraph summary covering:
|
26
|
+
- Overall performance with key metrics
|
27
|
+
- Confusion matrix or error distribution analysis
|
28
|
+
- Per-class/per-feature insights
|
29
|
+
- Cross-validation and generalization
|
30
|
+
- Model strengths and weaknesses
|
31
|
+
- Improvement recommendations
|
32
|
+
- Production readiness
|
33
|
+
|
34
|
+
Include specific numbers and identify weak areas.
|
35
|
+
|
36
|
+
Output JSON only following this schema:
|
37
|
+
[[OUTPUT_SCHEMA]]""",
|
38
|
+
runtime_template="[[TASK]]",
|
39
|
+
output_schema=ToolAgentOutput,
|
40
|
+
input_schema=TaskInput,
|
41
|
+
tools=["evaluate_model"],
|
42
|
+
model=None
|
43
|
+
)
|
@@ -0,0 +1,47 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel, Field
|
4
|
+
|
5
|
+
from agentz.profiles.base import Profile, ToolAgentOutput
|
6
|
+
|
7
|
+
|
8
|
+
class TaskInput(BaseModel):
|
9
|
+
"""Input schema for task-based runtime template."""
|
10
|
+
task: str = Field(description="The task to perform")
|
11
|
+
|
12
|
+
|
13
|
+
# Profile instance for model training agent
|
14
|
+
model_training_profile = Profile(
|
15
|
+
instructions="""You are a machine learning specialist. Your task is to train and evaluate models.
|
16
|
+
|
17
|
+
Model types:
|
18
|
+
- auto: Auto-detect best model
|
19
|
+
- random_forest: Random Forest (classification/regression)
|
20
|
+
- logistic_regression: Logistic Regression
|
21
|
+
- linear_regression: Linear Regression
|
22
|
+
- decision_tree: Decision Tree
|
23
|
+
|
24
|
+
Steps:
|
25
|
+
1. Use the train_model tool (it automatically uses the currently loaded dataset)
|
26
|
+
- Required: target_column (which column to predict)
|
27
|
+
- Optional: model_type (default: auto)
|
28
|
+
- The tool will train on the dataset that was previously loaded/preprocessed
|
29
|
+
2. The tool returns: model type, problem type, train/test scores, CV results, feature importance, predictions
|
30
|
+
3. Write a 3+ paragraph summary covering:
|
31
|
+
- Model selection and problem type
|
32
|
+
- Train/test performance with interpretation
|
33
|
+
- Cross-validation results and stability
|
34
|
+
- Top feature importances
|
35
|
+
- Overfitting/underfitting analysis
|
36
|
+
- Improvement recommendations
|
37
|
+
|
38
|
+
Include specific metrics (accuracy, R², CV mean±std).
|
39
|
+
|
40
|
+
Output JSON only following this schema:
|
41
|
+
[[OUTPUT_SCHEMA]]""",
|
42
|
+
runtime_template="[[TASK]]",
|
43
|
+
output_schema=ToolAgentOutput,
|
44
|
+
input_schema=TaskInput,
|
45
|
+
tools=["train_model"],
|
46
|
+
model=None
|
47
|
+
)
|
@@ -0,0 +1,47 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel, Field
|
4
|
+
|
5
|
+
from agentz.profiles.base import Profile, ToolAgentOutput
|
6
|
+
|
7
|
+
|
8
|
+
class TaskInput(BaseModel):
|
9
|
+
"""Input schema for task-based runtime template."""
|
10
|
+
task: str = Field(description="The task to perform")
|
11
|
+
|
12
|
+
|
13
|
+
# Profile instance for preprocessing agent
|
14
|
+
preprocessing_profile = Profile(
|
15
|
+
instructions="""You are a data preprocessing specialist. Your task is to clean and transform datasets.
|
16
|
+
|
17
|
+
Available operations:
|
18
|
+
- handle_missing: Fill missing values (mean/median/mode)
|
19
|
+
- remove_duplicates: Remove duplicate rows
|
20
|
+
- encode_categorical: Encode categorical variables
|
21
|
+
- scale_standard: Z-score normalization
|
22
|
+
- scale_minmax: Min-max scaling [0, 1]
|
23
|
+
- remove_outliers: IQR method
|
24
|
+
- feature_engineering: Create interaction features
|
25
|
+
|
26
|
+
Steps:
|
27
|
+
1. Use the preprocess_data tool (it automatically uses the currently loaded dataset)
|
28
|
+
- Required: operations list (which operations to perform)
|
29
|
+
- Optional: target_column (if mentioned in the task)
|
30
|
+
- The tool will preprocess the dataset that was previously loaded
|
31
|
+
2. The tool returns: operations applied, shape changes, summary of changes
|
32
|
+
3. Write a 2-3 paragraph summary covering:
|
33
|
+
- Operations performed and justification
|
34
|
+
- Shape changes and data modifications
|
35
|
+
- Impact on data quality
|
36
|
+
- Next steps (modeling, further preprocessing)
|
37
|
+
|
38
|
+
Include specific numbers (rows removed, values filled, etc.).
|
39
|
+
|
40
|
+
Output JSON only following this schema:
|
41
|
+
[[OUTPUT_SCHEMA]]""",
|
42
|
+
runtime_template="[[TASK]]",
|
43
|
+
output_schema=ToolAgentOutput,
|
44
|
+
input_schema=TaskInput,
|
45
|
+
tools=["preprocess_data"],
|
46
|
+
model=None
|
47
|
+
)
|
@@ -0,0 +1,47 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel, Field
|
4
|
+
|
5
|
+
from agentz.profiles.base import Profile, ToolAgentOutput
|
6
|
+
|
7
|
+
|
8
|
+
class TaskInput(BaseModel):
|
9
|
+
"""Input schema for task-based runtime template."""
|
10
|
+
task: str = Field(description="The task to perform")
|
11
|
+
|
12
|
+
|
13
|
+
# Profile instance for visualization agent
|
14
|
+
visualization_profile = Profile(
|
15
|
+
instructions="""You are a data visualization specialist. Your task is to create insightful visualizations.
|
16
|
+
|
17
|
+
Plot types:
|
18
|
+
- distribution: Histograms for numerical columns
|
19
|
+
- correlation: Heatmap for feature relationships
|
20
|
+
- scatter: 2D relationship plot (needs 2 columns)
|
21
|
+
- box: Outlier detection
|
22
|
+
- bar: Categorical data comparison
|
23
|
+
- pairplot: Pairwise relationships
|
24
|
+
|
25
|
+
Steps:
|
26
|
+
1. Use the create_visualization tool (it automatically uses the currently loaded dataset)
|
27
|
+
- Required: plot_type (which type of visualization to create)
|
28
|
+
- Optional: columns (which columns to include), target_column (for coloring)
|
29
|
+
- The tool will visualize the dataset that was previously loaded/preprocessed
|
30
|
+
2. The tool returns: plot type, columns plotted, output path, visual insights
|
31
|
+
3. Write a 2-3 paragraph summary covering:
|
32
|
+
- Visualization type and purpose
|
33
|
+
- Key patterns observed
|
34
|
+
- Data interpretation and context
|
35
|
+
- Actionable recommendations
|
36
|
+
- Suggestions for additional plots
|
37
|
+
|
38
|
+
Include specific observations (correlation values, outlier %, distribution shapes).
|
39
|
+
|
40
|
+
Output JSON only following this schema:
|
41
|
+
[[OUTPUT_SCHEMA]]""",
|
42
|
+
runtime_template="[[TASK]]",
|
43
|
+
output_schema=ToolAgentOutput,
|
44
|
+
input_schema=TaskInput,
|
45
|
+
tools=["create_visualization"],
|
46
|
+
model=None
|
47
|
+
)
|
@@ -0,0 +1,51 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import List
|
4
|
+
from pydantic import BaseModel, Field
|
5
|
+
|
6
|
+
from agentz.profiles.base import Profile
|
7
|
+
|
8
|
+
|
9
|
+
class EvaluateInput(BaseModel):
|
10
|
+
"""Input schema for evaluate agent runtime template."""
|
11
|
+
iteration: int = Field(description="Current iteration number")
|
12
|
+
elapsed_minutes: float = Field(description="Time elapsed in minutes")
|
13
|
+
max_minutes: float = Field(description="Maximum allowed minutes")
|
14
|
+
query: str = Field(description="Original user query")
|
15
|
+
history: str = Field(description="History of actions, findings and thoughts")
|
16
|
+
|
17
|
+
|
18
|
+
class EvaluateOutput(BaseModel):
|
19
|
+
"""Output schema for evaluate agent."""
|
20
|
+
research_complete: bool = Field(description="Boolean indicating if research is done")
|
21
|
+
outstanding_gaps: List[str] = Field(description="List of specific gaps that still need addressing", default_factory=list)
|
22
|
+
reasoning: str = Field(description="Clear explanation of the evaluation")
|
23
|
+
|
24
|
+
|
25
|
+
# Profile instance for evaluate agent
|
26
|
+
evaluate_profile = Profile(
|
27
|
+
instructions="""You are a research evaluation agent. Analyze research progress and determine if goals have been met.
|
28
|
+
|
29
|
+
Your responsibilities:
|
30
|
+
1. Assess whether the research task has been completed
|
31
|
+
2. Identify any remaining knowledge gaps
|
32
|
+
3. Provide clear reasoning for your evaluation
|
33
|
+
4. Suggest specific next steps if research is incomplete
|
34
|
+
|
35
|
+
Evaluate the research state and provide structured output with:
|
36
|
+
- research_complete: boolean indicating if research is done
|
37
|
+
- outstanding_gaps: list of specific gaps that still need addressing
|
38
|
+
- reasoning: clear explanation of your evaluation""",
|
39
|
+
runtime_template="""Current Iteration Number: [[ITERATION]]
|
40
|
+
Time Elapsed: [[ELAPSED_MINUTES]] minutes of maximum [[MAX_MINUTES]] minutes
|
41
|
+
|
42
|
+
ORIGINAL QUERY:
|
43
|
+
[[QUERY]]
|
44
|
+
|
45
|
+
HISTORY OF ACTIONS, FINDINGS AND THOUGHTS:
|
46
|
+
[[HISTORY]]""",
|
47
|
+
output_schema=EvaluateOutput,
|
48
|
+
input_schema=EvaluateInput,
|
49
|
+
tools=None,
|
50
|
+
model=None
|
51
|
+
)
|
@@ -0,0 +1,62 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel, Field
|
4
|
+
|
5
|
+
from agentz.profiles.base import Profile
|
6
|
+
|
7
|
+
|
8
|
+
class MemoryInput(BaseModel):
|
9
|
+
"""Input schema for memory agent runtime template."""
|
10
|
+
iteration: int = Field(description="Current iteration number")
|
11
|
+
query: str = Field(description="Original user query")
|
12
|
+
last_summary: str = Field(description="Last generated summary")
|
13
|
+
conversation_history: str = Field(description="Recent conversation history")
|
14
|
+
|
15
|
+
|
16
|
+
class MemoryAgentOutput(BaseModel):
|
17
|
+
"""Output schema for memory agent."""
|
18
|
+
summary: str = Field(description="Summary of the conversation history", default="")
|
19
|
+
|
20
|
+
|
21
|
+
# Profile instance for memory agent
|
22
|
+
memory_profile = Profile(
|
23
|
+
instructions="""You are a memory agent. Your role is to store and retrieve information from the conversation history.
|
24
|
+
|
25
|
+
Your responsibilities:
|
26
|
+
1. Thoroughly evaluate the conversation history and current question
|
27
|
+
2. Provide a comprehensive summary that will help answer the question.
|
28
|
+
3. Analyze progress made since the last summary
|
29
|
+
4. Generate a useful summary that combines previous and new information
|
30
|
+
5. Maintain continuity, especially when recent conversation history is limited
|
31
|
+
|
32
|
+
Task Guidelines
|
33
|
+
|
34
|
+
1. Information Analysis:
|
35
|
+
- Carefully analyze the conversation history to identify truly useful information.
|
36
|
+
- Focus on information that directly contributes to answering the question.
|
37
|
+
- Do NOT make assumptions, guesses, or inferences beyond what is explicitly stated.
|
38
|
+
- If information is missing or unclear, do NOT include it in your summary.
|
39
|
+
- Use the last summary as a baseline when recent history is sparse.
|
40
|
+
|
41
|
+
2. Summary Requirements:
|
42
|
+
- Extract only the most relevant information that is explicitly present in the conversation.
|
43
|
+
- Synthesize information from multiple exchanges when relevant.
|
44
|
+
- Only include information that is certain and clearly stated.
|
45
|
+
- Do NOT output or mention any information that is uncertain, insufficient, or cannot be confirmed.
|
46
|
+
|
47
|
+
Strictly avoid fabricating, inferring, or exaggerating any information not present in the conversation. Only output information that is certain and explicitly stated.""",
|
48
|
+
runtime_template="""You are at the end of iteration [[ITERATION]]. You need to generate a comprehensive and useful summary.
|
49
|
+
|
50
|
+
ORIGINAL QUERY:
|
51
|
+
[[QUERY]]
|
52
|
+
|
53
|
+
LAST SUMMARY:
|
54
|
+
[[LAST_SUMMARY]]
|
55
|
+
|
56
|
+
CONVERSATION HISTORY:
|
57
|
+
[[CONVERSATION_HISTORY]]""",
|
58
|
+
output_schema=MemoryAgentOutput,
|
59
|
+
input_schema=MemoryInput,
|
60
|
+
tools=None,
|
61
|
+
model=None
|
62
|
+
)
|
@@ -0,0 +1,48 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel, Field
|
4
|
+
|
5
|
+
from agentz.profiles.base import Profile
|
6
|
+
|
7
|
+
|
8
|
+
class ObserveInput(BaseModel):
|
9
|
+
"""Input schema for observe agent runtime template."""
|
10
|
+
iteration: int = Field(description="Current iteration number")
|
11
|
+
query: str = Field(description="Original user query")
|
12
|
+
history: str = Field(description="History of actions, findings and thoughts")
|
13
|
+
|
14
|
+
|
15
|
+
# Profile instance for observe agent
|
16
|
+
observe_profile = Profile(
|
17
|
+
instructions="""You are a research observation agent. Your role is to analyze the current state of research and provide thoughtful observations.
|
18
|
+
|
19
|
+
Your responsibilities:
|
20
|
+
1. Reflect on the progress made so far
|
21
|
+
2. Identify patterns and insights from previous iterations
|
22
|
+
3. Consider what has been learned and what remains unclear
|
23
|
+
4. Provide strategic thinking about next steps
|
24
|
+
5. Generate actionable observations that guide the research process
|
25
|
+
|
26
|
+
Analyze the provided context including:
|
27
|
+
- The original query/task
|
28
|
+
- Current iteration number and time elapsed
|
29
|
+
- Background context
|
30
|
+
- Previous iterations, actions, findings, and thoughts
|
31
|
+
|
32
|
+
Provide concise but insightful observations that help guide the research process. Focus on:
|
33
|
+
- What we've learned so far
|
34
|
+
- What patterns are emerging
|
35
|
+
- What areas need deeper investigation
|
36
|
+
- Strategic recommendations for next steps""",
|
37
|
+
runtime_template="""You are starting iteration [[ITERATION]] of your research process.
|
38
|
+
|
39
|
+
ORIGINAL QUERY:
|
40
|
+
[[QUERY]]
|
41
|
+
|
42
|
+
HISTORY OF ACTIONS, FINDINGS AND THOUGHTS:
|
43
|
+
[[HISTORY]]""",
|
44
|
+
output_schema=None,
|
45
|
+
input_schema=ObserveInput,
|
46
|
+
tools=None,
|
47
|
+
model=None
|
48
|
+
)
|
@@ -0,0 +1,66 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import List, Optional
|
4
|
+
from pydantic import BaseModel, Field
|
5
|
+
|
6
|
+
from agentz.profiles.base import Profile
|
7
|
+
|
8
|
+
|
9
|
+
class AgentTask(BaseModel):
|
10
|
+
"""Task definition for routing to specific agents."""
|
11
|
+
agent: str = Field(description="Name of the agent to use")
|
12
|
+
query: str = Field(description="Query/task for the agent")
|
13
|
+
gap: str = Field(description="The knowledge gap this task addresses")
|
14
|
+
entity_website: Optional[str] = Field(description="Optional entity or website context", default=None)
|
15
|
+
|
16
|
+
|
17
|
+
class AgentSelectionPlan(BaseModel):
|
18
|
+
"""Plan containing multiple agent tasks to address knowledge gaps."""
|
19
|
+
tasks: List[AgentTask] = Field(description="List of tasks for different agents", default_factory=list)
|
20
|
+
reasoning: str = Field(description="Reasoning for the agent selection", default="")
|
21
|
+
|
22
|
+
|
23
|
+
class RoutingInput(BaseModel):
|
24
|
+
"""Input schema for routing agent runtime template."""
|
25
|
+
query: str = Field(description="Original user query")
|
26
|
+
gap: str = Field(description="Knowledge gap to address")
|
27
|
+
history: str = Field(description="History of actions, findings and thoughts")
|
28
|
+
|
29
|
+
|
30
|
+
# Profile instance for routing agent
|
31
|
+
routing_profile = Profile(
|
32
|
+
instructions="""You are a task routing agent. Your role is to analyze knowledge gaps and route appropriate tasks to specialized agents.
|
33
|
+
|
34
|
+
Available agents: data_loader_agent, data_analysis_agent, preprocessing_agent, model_training_agent, evaluation_agent, visualization_agent, code_generation_agent, research_agent
|
35
|
+
|
36
|
+
Agent capabilities:
|
37
|
+
- data_loader_agent: Load and inspect datasets, understand data structure
|
38
|
+
- data_analysis_agent: Perform exploratory data analysis, statistical analysis
|
39
|
+
- preprocessing_agent: Clean data, handle missing values, feature engineering
|
40
|
+
- model_training_agent: Train machine learning models, hyperparameter tuning
|
41
|
+
- evaluation_agent: Evaluate model performance, generate metrics
|
42
|
+
- visualization_agent: Create charts, plots, and visualizations
|
43
|
+
- code_generation_agent: Generate code snippets and complete implementations
|
44
|
+
- research_agent: Research methodologies, best practices, domain knowledge
|
45
|
+
|
46
|
+
Your task:
|
47
|
+
1. Analyze the knowledge gap that needs to be addressed
|
48
|
+
2. Select the most appropriate agent(s) to handle the gap
|
49
|
+
3. Create specific, actionable tasks for each selected agent
|
50
|
+
4. Ensure tasks are clear and focused
|
51
|
+
|
52
|
+
Create a routing plan with appropriate agents and tasks to address the knowledge gap.""",
|
53
|
+
runtime_template="""ORIGINAL QUERY:
|
54
|
+
[[QUERY]]
|
55
|
+
|
56
|
+
KNOWLEDGE GAP TO ADDRESS:
|
57
|
+
[[GAP]]
|
58
|
+
|
59
|
+
|
60
|
+
HISTORY OF ACTIONS, FINDINGS AND THOUGHTS:
|
61
|
+
[[HISTORY]]""",
|
62
|
+
output_schema=AgentSelectionPlan,
|
63
|
+
input_schema=RoutingInput,
|
64
|
+
tools=None,
|
65
|
+
model=None
|
66
|
+
)
|
@@ -0,0 +1,51 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import Optional
|
4
|
+
from pydantic import BaseModel, Field
|
5
|
+
|
6
|
+
from agentz.profiles.base import Profile
|
7
|
+
|
8
|
+
|
9
|
+
class WriterInput(BaseModel):
|
10
|
+
"""Input schema for writer agent runtime template."""
|
11
|
+
user_prompt: str = Field(description="Original user query/prompt")
|
12
|
+
data_path: str = Field(description="Path to the dataset")
|
13
|
+
findings: str = Field(description="Research findings to synthesize")
|
14
|
+
guidelines_block: Optional[str] = Field(default="", description="Optional formatting guidelines")
|
15
|
+
|
16
|
+
|
17
|
+
# Profile instance for writer agent
|
18
|
+
writer_profile = Profile(
|
19
|
+
instructions="""You are a technical writing agent specialized in creating comprehensive data science reports.
|
20
|
+
|
21
|
+
Your responsibilities:
|
22
|
+
1. Synthesize findings from multiple research iterations
|
23
|
+
2. Create clear, well-structured reports with proper formatting
|
24
|
+
3. Include executive summaries when appropriate
|
25
|
+
4. Present technical information in an accessible manner
|
26
|
+
5. Follow specific formatting guidelines when provided
|
27
|
+
6. Ensure all key insights and recommendations are highlighted
|
28
|
+
|
29
|
+
Report Structure Guidelines:
|
30
|
+
- Start with a clear summary of the task/objective
|
31
|
+
- Present methodology and approach
|
32
|
+
- Include key findings and insights
|
33
|
+
- Provide actionable recommendations
|
34
|
+
- Use proper markdown formatting when appropriate
|
35
|
+
- Include code examples when relevant
|
36
|
+
- Ensure technical accuracy while maintaining readability
|
37
|
+
|
38
|
+
Focus on creating professional, comprehensive reports that effectively communicate the research findings and their practical implications.""",
|
39
|
+
runtime_template="""Provide a response based on the query and findings below with as much detail as possible[[GUIDELINES_BLOCK]]
|
40
|
+
|
41
|
+
QUERY: [[USER_PROMPT]]
|
42
|
+
|
43
|
+
DATASET: [[DATA_PATH]]
|
44
|
+
|
45
|
+
FINDINGS:
|
46
|
+
[[FINDINGS]]""",
|
47
|
+
output_schema=None,
|
48
|
+
input_schema=WriterInput,
|
49
|
+
tools=None,
|
50
|
+
model=None
|
51
|
+
)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel, Field
|
4
|
+
|
5
|
+
from agentz.profiles.base import Profile
|
6
|
+
|
7
|
+
|
8
|
+
class InstructionsInput(BaseModel):
|
9
|
+
"""Input schema for instructions-based runtime template."""
|
10
|
+
instructions: str = Field(description="The instructions to follow")
|
11
|
+
|
12
|
+
|
13
|
+
# Profile instance for browser agent
|
14
|
+
browser_profile = Profile(
|
15
|
+
instructions="You are a browser agent. Your task is to interact with the browser MCP server following the instructions provided.",
|
16
|
+
runtime_template="[[INSTRUCTIONS]]",
|
17
|
+
output_schema=None,
|
18
|
+
input_schema=InstructionsInput,
|
19
|
+
tools=None,
|
20
|
+
model=None
|
21
|
+
)
|