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.

⚡️ Speed up method `Repository.is_git_repo` by 72,270% (#2381)

Saurabh Misra4d7aacb5f243
diff --git a/src/crewai/cli/git.py b/src/crewai/cli/git.py
index 94c3648b0..58836e733 100644
--- a/src/crewai/cli/git.py
+++ b/src/crewai/cli/git.py
@@ -1,4 +1,5 @@
import subprocess
+from functools import lru_cache
class Repository:
@@ -35,6 +36,7 @@ class Repository:
encoding="utf-8",
).strip()
+ @lru_cache(maxsize=None)
def is_git_repo(self) -> bool:
"""Check if the current directory is a git repository."""
try: