Move AGENT_GOAL back to env file

This commit is contained in:
Laine
2025-03-12 10:30:42 -04:00
parent e0b3a31ea8
commit 697244e970
2 changed files with 6 additions and 13 deletions

View File

@@ -1,3 +1,4 @@
import os
from fastapi import FastAPI
from typing import Optional
from temporalio.client import Client
@@ -11,7 +12,7 @@ from workflows.agent_goal_workflow import AgentGoalWorkflow
from models.data_types import CombinedInput, AgentGoalWorkflowParams
from tools.goal_registry import goal_list
from fastapi.middleware.cors import CORSMiddleware
from shared.config import get_temporal_client, TEMPORAL_TASK_QUEUE, AGENT_GOAL
from shared.config import get_temporal_client, TEMPORAL_TASK_QUEUE
app = FastAPI()
temporal_client: Optional[Client] = None
@@ -22,13 +23,10 @@ load_dotenv()
def get_initial_agent_goal():
"""Get the agent goal from environment variables."""
if AGENT_GOAL is not None:
for listed_goal in goal_list:
if listed_goal.id == AGENT_GOAL:
return listed_goal
else:
#if no goal is set in the config file, default to choosing an agent
return goal_list.get("goal_choose_agent_type")
env_goal = os.getenv("AGENT_GOAL", "goal_choose_agent_type") #if no goal is set in the env file, default to choosing an agent
for listed_goal in goal_list:
if listed_goal.id == env_goal:
return listed_goal
@app.on_event("startup")