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.

chore: readd user eligibility check (#2577)

cthomase2e223dafa67
diff --git a/letta/server/rest_api/routers/v1/agents.py b/letta/server/rest_api/routers/v1/agents.py
index d38d29ebd..fbdcf5184 100644
--- a/letta/server/rest_api/routers/v1/agents.py
+++ b/letta/server/rest_api/routers/v1/agents.py
@@ -660,7 +660,7 @@ async def send_message(
"""
actor = await server.user_manager.get_actor_or_default_async(actor_id=actor_id)
request_start_timestamp_ns = get_utc_timestamp_ns()
- # user_eligible = actor.organization_id not in ["org-4a3af5dd-4c6a-48cb-ac13-3f73ecaaa4bf", "org-4ab3f6e8-9a44-4bee-aeb6-c681cbbc7bf6"]
+ user_eligible = actor.organization_id not in ["org-4a3af5dd-4c6a-48cb-ac13-3f73ecaaa4bf", "org-4ab3f6e8-9a44-4bee-aeb6-c681cbbc7bf6"]
# TODO: This is redundant, remove soon
agent = await server.agent_manager.get_agent_by_id_async(agent_id, actor, include_relationships=["multi_agent_group"])
agent_eligible = agent.enable_sleeptime or agent.agent_type == AgentType.sleeptime_agent or not agent.multi_agent_group
@@ -668,7 +668,7 @@ async def send_message(
feature_enabled = settings.use_experimental or experimental_header.lower() == "true"
model_compatible = agent.llm_config.model_endpoint_type in ["anthropic", "openai", "together", "google_ai", "google_vertex"]
- if agent_eligible and feature_enabled and model_compatible:
+ if user_eligible and agent_eligible and feature_enabled and model_compatible:
if agent.enable_sleeptime and agent.agent_type != AgentType.voice_convo_agent:
experimental_agent = SleeptimeMultiAgentV2(
agent_id=agent_id,
@@ -741,7 +741,7 @@ async def send_message_streaming(
"""
request_start_timestamp_ns = get_utc_timestamp_ns()
actor = await server.user_manager.get_actor_or_default_async(actor_id=actor_id)
- # user_eligible = actor.organization_id not in ["org-4a3af5dd-4c6a-48cb-ac13-3f73ecaaa4bf", "org-4ab3f6e8-9a44-4bee-aeb6-c681cbbc7bf6"]
+ user_eligible = actor.organization_id not in ["org-4a3af5dd-4c6a-48cb-ac13-3f73ecaaa4bf", "org-4ab3f6e8-9a44-4bee-aeb6-c681cbbc7bf6"]
# TODO: This is redundant, remove soon
agent = await server.agent_manager.get_agent_by_id_async(agent_id, actor, include_relationships=["multi_agent_group"])
agent_eligible = agent.enable_sleeptime or agent.agent_type == AgentType.sleeptime_agent or not agent.multi_agent_group
@@ -752,7 +752,7 @@ async def send_message_streaming(
not_letta_endpoint = not ("inference.letta.com" in agent.llm_config.model_endpoint)
request_start_timestamp_ns = get_utc_timestamp_ns()
- if agent_eligible and feature_enabled and model_compatible:
+ if user_eligible and agent_eligible and feature_enabled and model_compatible:
if agent.enable_sleeptime and agent.agent_type != AgentType.voice_convo_agent:
experimental_agent = SleeptimeMultiAgentV2(
agent_id=agent_id,