Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

respecting OPENAI_MODEL_NAME

João Mourac4167a551791
diff --git a/src/crewai/agent.py b/src/crewai/agent.py
index 0fceb6a41..ec9fbeda2 100644
--- a/src/crewai/agent.py
+++ b/src/crewai/agent.py
@@ -119,7 +119,8 @@ class Agent(BaseAgent):
def post_init_setup(self):
self.agent_ops_agent_name = self.role
self.llm = (
- getattr(self.llm, "model_name", None)
+ os.environ.get("OPENAI_MODEL_NAME")
+ or getattr(self.llm, "model_name", None)
or getattr(self.llm, "deployment_name", None)
or self.llm
)