|
1 | | -import json |
2 | | -import shutil |
3 | | -import sys |
| 1 | +from typing import Optional |
| 2 | +import os, sys |
4 | 3 | import time |
5 | 4 | from datetime import datetime |
6 | | -from typing import Optional |
7 | 5 | from pathlib import Path |
8 | | -import requests |
| 6 | + |
| 7 | +import json |
| 8 | +import shutil |
9 | 9 | import itertools |
10 | 10 |
|
11 | 11 | from art import text2art |
12 | 12 | import inquirer |
13 | | -import os |
14 | | -import importlib.resources |
15 | 13 | from cookiecutter.main import cookiecutter |
16 | | -from dotenv import load_dotenv |
17 | | -import subprocess |
18 | | -from packaging.metadata import Metadata |
19 | 14 |
|
20 | 15 | from .agentstack_data import ( |
21 | 16 | FrameworkData, |
|
28 | 23 | from agentstack.tools import get_all_tools |
29 | 24 | from agentstack.generation.files import ConfigFile, ProjectFile |
30 | 25 | from agentstack import frameworks |
31 | | -from agentstack import packaging |
32 | 26 | from agentstack import generation |
| 27 | +from agentstack import inputs |
33 | 28 | from agentstack.agents import get_all_agents |
34 | 29 | from agentstack.tasks import get_all_tasks |
35 | 30 | from agentstack.utils import open_json_file, term_color, is_snake_case, get_framework |
36 | | -from agentstack.update import AGENTSTACK_PACKAGE |
37 | 31 | from agentstack.proj_templates import TemplateConfig |
38 | 32 |
|
39 | 33 |
|
@@ -162,27 +156,6 @@ def configure_default_model(path: Optional[str] = None): |
162 | 156 | agentstack_config.default_model = model |
163 | 157 |
|
164 | 158 |
|
165 | | -def run_project(framework: str, path: str = ''): |
166 | | - """Validate that the project is ready to run and then run it.""" |
167 | | - if framework not in frameworks.SUPPORTED_FRAMEWORKS: |
168 | | - print(term_color(f"Framework {framework} is not supported by agentstack.", 'red')) |
169 | | - sys.exit(1) |
170 | | - |
171 | | - _path = Path(path) |
172 | | - |
173 | | - try: |
174 | | - frameworks.validate_project(framework, _path) |
175 | | - except frameworks.ValidationError as e: |
176 | | - print(term_color("Project validation failed:", 'red')) |
177 | | - print(e) |
178 | | - sys.exit(1) |
179 | | - |
180 | | - load_dotenv(Path.home() / '.env') # load the user's .env file |
181 | | - load_dotenv(_path / '.env', override=True) # load the project's .env file |
182 | | - print("Running your agent...") |
183 | | - subprocess.run(['python', 'src/main.py'], env=os.environ) |
184 | | - |
185 | | - |
186 | 159 | def ask_framework() -> str: |
187 | 160 | framework = "CrewAI" |
188 | 161 | # framework = inquirer.list_input( |
@@ -401,7 +374,7 @@ def insert_template( |
401 | 374 | project_structure = ProjectStructure() |
402 | 375 | project_structure.agents = design["agents"] |
403 | 376 | project_structure.tasks = design["tasks"] |
404 | | - project_structure.set_inputs(design["inputs"]) |
| 377 | + project_structure.inputs = design["inputs"] |
405 | 378 |
|
406 | 379 | cookiecutter_data = CookiecutterData( |
407 | 380 | project_metadata=project_metadata, |
@@ -537,21 +510,16 @@ def export_template(output_filename: str, path: str = ''): |
537 | 510 | ) |
538 | 511 | ) |
539 | 512 |
|
540 | | - inputs: list[str] = [] |
541 | | - # TODO extract inputs from project |
542 | | - # for input in frameworks.get_input_names(): |
543 | | - # inputs.append(input) |
544 | | - |
545 | 513 | template = TemplateConfig( |
546 | | - template_version=1, |
| 514 | + template_version=2, |
547 | 515 | name=metadata.project_name, |
548 | 516 | description=metadata.project_description, |
549 | 517 | framework=framework, |
550 | 518 | method="sequential", # TODO this needs to be stored in the project somewhere |
551 | 519 | agents=agents, |
552 | 520 | tasks=tasks, |
553 | 521 | tools=tools, |
554 | | - inputs=inputs, |
| 522 | + inputs=inputs.get_inputs(), |
555 | 523 | ) |
556 | 524 |
|
557 | 525 | try: |
|
0 commit comments