@@ -45,15 +45,21 @@ def _populate_max_entrypoint(self):
4545 """This entrypoint has tools and agents."""
4646 entrypoint_path = frameworks .get_entrypoint_path (self .framework )
4747 shutil .copy (BASE_PATH / f"fixtures/frameworks/{ self .framework } /entrypoint_max.py" , entrypoint_path )
48+ shutil .copy (BASE_PATH / 'fixtures/agents_max.yaml' , self .project_dir / AGENTS_FILENAME )
49+ shutil .copy (BASE_PATH / 'fixtures/tasks_max.yaml' , self .project_dir / TASKS_FILENAME )
4850
4951 def _get_test_agent (self ) -> AgentConfig :
50- shutil .copy (BASE_PATH / 'fixtures/agents_max.yaml' , self .project_dir / AGENTS_FILENAME )
5152 return AgentConfig ('agent_name' )
5253
54+ def _get_test_agent_alternate (self ) -> AgentConfig :
55+ return AgentConfig ('second_agent_name' )
56+
5357 def _get_test_task (self ) -> TaskConfig :
54- shutil .copy (BASE_PATH / 'fixtures/tasks_max.yaml' , self .project_dir / TASKS_FILENAME )
5558 return TaskConfig ('task_name' )
5659
60+ def _get_test_task_alternate (self ) -> TaskConfig :
61+ return TaskConfig ('task_name_two' )
62+
5763 def _get_test_tool (self ) -> ToolConfig :
5864 return ToolConfig (name = 'test_tool' , category = 'test' , tools = ['test_tool' ])
5965
@@ -88,6 +94,8 @@ def test_validate_project_invalid(self):
8894
8995 def test_validate_project_has_agent_no_task_invalid (self ):
9096 self ._populate_min_entrypoint ()
97+ shutil .copy (BASE_PATH / 'fixtures/agents_max.yaml' , self .project_dir / AGENTS_FILENAME )
98+
9199 frameworks .add_agent (self ._get_test_agent ())
92100 with self .assertRaises (ValidationError ) as context :
93101 frameworks .validate_project ()
@@ -98,6 +106,38 @@ def test_validate_project_has_task_no_agent_invalid(self):
98106 with self .assertRaises (ValidationError ) as context :
99107 frameworks .validate_project ()
100108
109+ def test_validate_project_missing_agent_method_invalid (self ):
110+ """Ensure that all agents have a method defined in the entrypoint."""
111+ self ._populate_max_entrypoint ()
112+ # add an extra entry to agents.yaml
113+ with open (self .project_dir / AGENTS_FILENAME , 'a' ) as f :
114+ f .write ("""\n extra_agent:
115+ role: >-
116+ role
117+ goal: >-
118+ this is a goal
119+ backstory: >-
120+ this is a backstory
121+ llm: openai/gpt-4o""" )
122+ with self .assertRaises (ValidationError ) as context :
123+ frameworks .validate_project ()
124+
125+ def test_validate_project_missing_task_method_invalid (self ):
126+ """Ensure that all tasks have a method defined in the entrypoint."""
127+ self ._populate_max_entrypoint ()
128+ # add an extra entry to tasks.yaml
129+ with open (self .project_dir / TASKS_FILENAME , 'a' ) as f :
130+ f .write ("""\n extra_task:
131+ description: >-
132+ Add your description here
133+ expected_output: >-
134+ Add your expected output here
135+ agent: >-
136+ default_agent""" )
137+
138+ with self .assertRaises (ValidationError ) as context :
139+ frameworks .validate_project ()
140+
101141 def test_get_agent_tool_names (self ):
102142 self ._populate_max_entrypoint ()
103143 frameworks .add_tool (self ._get_test_tool (), 'agent_name' )
@@ -167,6 +207,9 @@ def test_get_tool_callables(self, tool_config):
167207
168208 def test_get_graph (self ):
169209 self ._populate_max_entrypoint ()
210+ shutil .copy (BASE_PATH / 'fixtures/agents_max.yaml' , self .project_dir / AGENTS_FILENAME )
211+ shutil .copy (BASE_PATH / 'fixtures/tasks_max.yaml' , self .project_dir / TASKS_FILENAME )
212+
170213 self ._get_test_agent ()
171214 self ._get_test_task ()
172215
0 commit comments