mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-15 14:08:08 +01:00
Add the category tag to the goals and example env file, and filter the results based on tags in list_agents
This commit is contained in:
@@ -1,16 +1,32 @@
|
||||
import os
|
||||
import tools.goal_registry as goals
|
||||
|
||||
def list_agents(args: dict) -> dict:
|
||||
|
||||
goal_categories_start = os.getenv("GOAL_CATEGORIES")
|
||||
if goal_categories_start is None:
|
||||
goal_categories = ["all"] # default to 'all' categories
|
||||
else:
|
||||
goal_categories_start.strip().lower() # handle extra spaces or non-lowercase
|
||||
goal_categories = goal_categories_start.split(",")
|
||||
|
||||
# always show goals labeled as "system," like the goal chooser
|
||||
if "system" not in goal_categories:
|
||||
goal_categories.append("system")
|
||||
|
||||
agents = []
|
||||
if goals.goal_list is not None:
|
||||
for goal in goals.goal_list:
|
||||
agents.append(
|
||||
{
|
||||
"agent_name": goal.agent_name,
|
||||
"goal_id": goal.id,
|
||||
"agent_description": goal.agent_friendly_description,
|
||||
}
|
||||
# add to list if either
|
||||
# - all
|
||||
# - current goal's tag is in goal_categories
|
||||
if "all" in goal_categories or goal.category_tag in goal_categories:
|
||||
agents.append(
|
||||
{
|
||||
"agent_name": goal.agent_name,
|
||||
"goal_id": goal.id,
|
||||
"agent_description": goal.agent_friendly_description,
|
||||
}
|
||||
)
|
||||
return {
|
||||
"agents": agents,
|
||||
|
||||
Reference in New Issue
Block a user