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 fastapi import FastAPI
from typing import Optional from typing import Optional
from temporalio.client import Client from temporalio.client import Client
@@ -11,7 +12,7 @@ from workflows.agent_goal_workflow import AgentGoalWorkflow
from models.data_types import CombinedInput, AgentGoalWorkflowParams from models.data_types import CombinedInput, AgentGoalWorkflowParams
from tools.goal_registry import goal_list from tools.goal_registry import goal_list
from fastapi.middleware.cors import CORSMiddleware 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() app = FastAPI()
temporal_client: Optional[Client] = None temporal_client: Optional[Client] = None
@@ -22,13 +23,10 @@ load_dotenv()
def get_initial_agent_goal(): def get_initial_agent_goal():
"""Get the agent goal from environment variables.""" """Get the agent goal from environment variables."""
if AGENT_GOAL is not None: 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: for listed_goal in goal_list:
if listed_goal.id == AGENT_GOAL: if listed_goal.id == env_goal:
return listed_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")
@app.on_event("startup") @app.on_event("startup")

View File

@@ -16,11 +16,6 @@ TEMPORAL_TLS_CERT = os.getenv("TEMPORAL_TLS_CERT", "")
TEMPORAL_TLS_KEY = os.getenv("TEMPORAL_TLS_KEY", "") TEMPORAL_TLS_KEY = os.getenv("TEMPORAL_TLS_KEY", "")
TEMPORAL_API_KEY = os.getenv("TEMPORAL_API_KEY", "") TEMPORAL_API_KEY = os.getenv("TEMPORAL_API_KEY", "")
#Starting agent goal - 1st goal is always to help user pick a next goal
AGENT_GOAL = "goal_choose_agent_type"
#AGENT_GOAL = "goal_event_flight_invoice"
async def get_temporal_client() -> Client: async def get_temporal_client() -> Client:
""" """
Creates a Temporal client based on environment configuration. Creates a Temporal client based on environment configuration.