From b1e39b9806865758a3c43ac60770b03bfbb845a6 Mon Sep 17 00:00:00 2001 From: sawradip Date: Mon, 1 Sep 2025 09:10:47 +0600 Subject: [PATCH] feat: template init bugged fixed --- runagent/sdk/template_manager.py | 2 +- runagent/utils/agent.py | 11 +++++++++-- runagent/utils/config.py | 1 + runagent/utils/enums.py | 1 + templates/default/default/email_agent.py | 4 ++-- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/runagent/sdk/template_manager.py b/runagent/sdk/template_manager.py index 24ddec9..82260b5 100644 --- a/runagent/sdk/template_manager.py +++ b/runagent/sdk/template_manager.py @@ -158,7 +158,7 @@ def _create_project_config(self, folder_path: Path): existing_config.created_at = time.strftime("%Y-%m-%d %H:%M:%S") config_content = existing_config.model_dump( - exclude={"agent_architecture"} + exclude={"agent_architecture", "framework"} ) Config.create_config(str(folder_path), config_content) diff --git a/runagent/utils/agent.py b/runagent/utils/agent.py index b7113e3..abefdf2 100644 --- a/runagent/utils/agent.py +++ b/runagent/utils/agent.py @@ -3,7 +3,7 @@ from pathlib import Path from runagent.constants import AGENT_CONFIG_FILE_NAME from runagent.utils.imports import PackageImporter -from runagent.utils.schema import RunAgentConfig +from runagent.utils.schema import RunAgentConfig, PythonicEntryPoint from .enums import FrameworkType @@ -130,7 +130,14 @@ def validate_agent( config = get_agent_config(folder_path) - is_valid, details = validate_pythonic_agent(config, dynamic_loading, folder_path) + if isinstance(config.agent_architecture.entrypoints[0], PythonicEntryPoint): + is_valid, details = validate_pythonic_agent(config, dynamic_loading, folder_path) + return is_valid, details + else: + return True, { + "valid": True, + "error_msgs": [], + } def validate_pythonic_agent(config, dynamic_loading, folder_path): diff --git a/runagent/utils/config.py b/runagent/utils/config.py index d5ea181..7ebb41b 100644 --- a/runagent/utils/config.py +++ b/runagent/utils/config.py @@ -42,6 +42,7 @@ def create_config(project_dir: str, config_content: t.Dict[str, t.Any]) -> str: # Write config file with config_file.open("w") as f: + json.dump(config_content, f, indent=2) return str(config_file) diff --git a/runagent/utils/enums.py b/runagent/utils/enums.py index 956ed27..89a2a88 100644 --- a/runagent/utils/enums.py +++ b/runagent/utils/enums.py @@ -12,6 +12,7 @@ class PythonicType(Enum): AGNO = "agno" AUTOGEN = "autogen" CREWAI = "crewai" + DEFAULT = "default" LANGCHAIN = "langchain" LANGGRAPH = "langgraph" LETTA = "letta" diff --git a/templates/default/default/email_agent.py b/templates/default/default/email_agent.py index b00a481..d906361 100644 --- a/templates/default/default/email_agent.py +++ b/templates/default/default/email_agent.py @@ -157,7 +157,7 @@ def chat_completion_create(self, model: str = None, stream: bool = False, max_tokens: int = 1000, - temperature: float = 0.7) -> Iterator[StreamChunk] | CompletionResponse: + temperature: float = 0.7): """ Main method to simulate AI chat completion """ @@ -379,7 +379,7 @@ def create(self, model: str = "gpt-4", messages: list = None, stream: bool = False, - **kwargs) -> Iterator[StreamChunk] | CompletionResponse: + **kwargs): """OpenAI-compatible create method""" return self.agent.chat_completion_create( messages=messages or [],