Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix: add anthropic api key check before using token counter (#3628)

cthomasf3ab6bb550ec
diff --git a/letta/agent.py b/letta/agent.py
index 636b70ae6..3cfaec5a3 100644
--- a/letta/agent.py
+++ b/letta/agent.py
@@ -1298,7 +1298,7 @@ class Agent(BaseAgent):
)
async def get_context_window_async(self) -> ContextWindowOverview:
- if os.getenv("LETTA_ENVIRONMENT") == "PRODUCTION":
+ if os.getenv("LETTA_ENVIRONMENT") == "PRODUCTION" and os.getenv("ANTHROPIC_API_KEY"):
return await self.get_context_window_from_anthropic_async()
return await self.get_context_window_from_tiktoken_async()