letta-nightly 0.11.7.dev20250917104122__py3-none-any.whl → 0.11.7.dev20250918104055__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- letta/agent.py +3 -3
- letta/agents/agent_loop.py +2 -1
- letta/agents/base_agent.py +1 -1
- letta/agents/letta_agent_v2.py +3 -3
- letta/agents/temporal/activities/__init__.py +4 -0
- letta/agents/temporal/activities/example_activity.py +7 -0
- letta/agents/temporal/activities/prepare_messages.py +10 -0
- letta/agents/temporal/temporal_agent_workflow.py +56 -0
- letta/agents/temporal/types.py +25 -0
- letta/agents/voice_agent.py +2 -2
- letta/orm/agent.py +4 -3
- letta/prompts/prompt_generator.py +4 -4
- letta/schemas/agent.py +4 -193
- letta/schemas/enums.py +15 -0
- letta/schemas/memory.py +216 -103
- letta/schemas/step.py +5 -1
- letta/schemas/tool_rule.py +34 -44
- letta/server/rest_api/routers/v1/steps.py +29 -0
- letta/server/server.py +2 -2
- letta/services/agent_manager.py +4 -6
- letta/services/helpers/agent_manager_helper.py +4 -4
- letta/services/step_manager.py +26 -0
- letta/services/summarizer/summarizer.py +25 -3
- letta/services/tool_executor/sandbox_tool_executor.py +2 -2
- letta/services/tool_sandbox/base.py +135 -8
- letta/settings.py +2 -2
- {letta_nightly-0.11.7.dev20250917104122.dist-info → letta_nightly-0.11.7.dev20250918104055.dist-info}/METADATA +2 -2
- {letta_nightly-0.11.7.dev20250917104122.dist-info → letta_nightly-0.11.7.dev20250918104055.dist-info}/RECORD +31 -27
- letta/templates/template_helper.py +0 -53
- {letta_nightly-0.11.7.dev20250917104122.dist-info → letta_nightly-0.11.7.dev20250918104055.dist-info}/WHEEL +0 -0
- {letta_nightly-0.11.7.dev20250917104122.dist-info → letta_nightly-0.11.7.dev20250918104055.dist-info}/entry_points.txt +0 -0
- {letta_nightly-0.11.7.dev20250917104122.dist-info → letta_nightly-0.11.7.dev20250918104055.dist-info}/licenses/LICENSE +0 -0
letta/agent.py
CHANGED
@@ -42,7 +42,7 @@ from letta.memory import summarize_messages
|
|
42
42
|
from letta.orm import User
|
43
43
|
from letta.otel.tracing import log_event, trace_method
|
44
44
|
from letta.prompts.prompt_generator import PromptGenerator
|
45
|
-
from letta.schemas.agent import AgentState, AgentStepResponse, UpdateAgent
|
45
|
+
from letta.schemas.agent import AgentState, AgentStepResponse, UpdateAgent
|
46
46
|
from letta.schemas.block import BlockUpdate
|
47
47
|
from letta.schemas.embedding_config import EmbeddingConfig
|
48
48
|
from letta.schemas.enums import MessageRole, ProviderType, StepStatus, ToolType
|
@@ -221,7 +221,7 @@ class Agent(BaseAgent):
|
|
221
221
|
self.agent_state.memory = Memory(
|
222
222
|
blocks=[self.block_manager.get_block_by_id(block.id, actor=self.user) for block in self.agent_state.memory.get_blocks()],
|
223
223
|
file_blocks=self.agent_state.memory.file_blocks,
|
224
|
-
|
224
|
+
agent_type=self.agent_state.agent_type,
|
225
225
|
)
|
226
226
|
|
227
227
|
# NOTE: don't do this since re-buildin the memory is handled at the start of the step
|
@@ -880,7 +880,7 @@ class Agent(BaseAgent):
|
|
880
880
|
current_persisted_memory = Memory(
|
881
881
|
blocks=[self.block_manager.get_block_by_id(block.id, actor=self.user) for block in self.agent_state.memory.get_blocks()],
|
882
882
|
file_blocks=self.agent_state.memory.file_blocks,
|
883
|
-
|
883
|
+
agent_type=self.agent_state.agent_type,
|
884
884
|
) # read blocks from DB
|
885
885
|
self.update_memory_if_changed(current_persisted_memory)
|
886
886
|
|
letta/agents/agent_loop.py
CHANGED
@@ -3,7 +3,8 @@ from typing import TYPE_CHECKING
|
|
3
3
|
from letta.agents.base_agent_v2 import BaseAgentV2
|
4
4
|
from letta.agents.letta_agent_v2 import LettaAgentV2
|
5
5
|
from letta.groups.sleeptime_multi_agent_v3 import SleeptimeMultiAgentV3
|
6
|
-
from letta.schemas.agent import AgentState
|
6
|
+
from letta.schemas.agent import AgentState
|
7
|
+
from letta.schemas.enums import AgentType
|
7
8
|
|
8
9
|
if TYPE_CHECKING:
|
9
10
|
from letta.orm import User
|
letta/agents/base_agent.py
CHANGED
@@ -139,7 +139,7 @@ class BaseAgent(ABC):
|
|
139
139
|
curr_dynamic_section = extract_dynamic_section(curr_system_message_text)
|
140
140
|
|
141
141
|
# generate just the memory string with current state for comparison
|
142
|
-
curr_memory_str =
|
142
|
+
curr_memory_str = agent_state.memory.compile(
|
143
143
|
tool_usage_rules=tool_constraint_block, sources=agent_state.sources, max_files_open=agent_state.max_files_open
|
144
144
|
)
|
145
145
|
new_dynamic_section = extract_dynamic_section(curr_memory_str)
|
letta/agents/letta_agent_v2.py
CHANGED
@@ -29,8 +29,8 @@ from letta.local_llm.constants import INNER_THOUGHTS_KWARG
|
|
29
29
|
from letta.log import get_logger
|
30
30
|
from letta.otel.tracing import log_event, trace_method, tracer
|
31
31
|
from letta.prompts.prompt_generator import PromptGenerator
|
32
|
-
from letta.schemas.agent import AgentState,
|
33
|
-
from letta.schemas.enums import JobStatus, MessageRole, MessageStreamStatus, StepStatus
|
32
|
+
from letta.schemas.agent import AgentState, UpdateAgent
|
33
|
+
from letta.schemas.enums import AgentType, JobStatus, MessageRole, MessageStreamStatus, StepStatus
|
34
34
|
from letta.schemas.letta_message import LettaMessage, MessageType
|
35
35
|
from letta.schemas.letta_message_content import OmittedReasoningContent, ReasoningContent, RedactedReasoningContent, TextContent
|
36
36
|
from letta.schemas.letta_response import LettaResponse
|
@@ -679,7 +679,7 @@ class LettaAgentV2(BaseAgentV2):
|
|
679
679
|
curr_dynamic_section = extract_dynamic_section(curr_system_message_text)
|
680
680
|
|
681
681
|
# generate just the memory string with current state for comparison
|
682
|
-
curr_memory_str =
|
682
|
+
curr_memory_str = agent_state.memory.compile(
|
683
683
|
tool_usage_rules=tool_constraint_block, sources=agent_state.sources, max_files_open=agent_state.max_files_open
|
684
684
|
)
|
685
685
|
new_dynamic_section = extract_dynamic_section(curr_memory_str)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
from temporalio import activity
|
2
|
+
from ..types import WorkflowInputParams, PreparedMessages
|
3
|
+
|
4
|
+
@activity.defn(name="prepare_messages")
|
5
|
+
async def prepare_messages(input_: WorkflowInputParams) -> PreparedMessages:
|
6
|
+
# TODO
|
7
|
+
return PreparedMessages(
|
8
|
+
in_context_messages=[],
|
9
|
+
input_messages_to_persist=[],
|
10
|
+
)
|
@@ -0,0 +1,56 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from datetime import timedelta
|
3
|
+
from temporalio import workflow
|
4
|
+
|
5
|
+
from ...schemas.letta_stop_reason import StopReasonType
|
6
|
+
from ...schemas.usage import LettaUsageStatistics
|
7
|
+
|
8
|
+
# Import activity, passing it through the sandbox without reloading the module
|
9
|
+
with workflow.unsafe.imports_passed_through():
|
10
|
+
from .activities import prepare_messages, example_activity
|
11
|
+
from .types import WorkflowInputParams, FinalResult
|
12
|
+
|
13
|
+
@workflow.defn
|
14
|
+
class TemporalAgentWorkflow:
|
15
|
+
@workflow.run
|
16
|
+
async def run(self, params: WorkflowInputParams) -> FinalResult:
|
17
|
+
messages = await workflow.execute_activity(
|
18
|
+
prepare_messages, params, start_to_close_timeout=timedelta(seconds=5)
|
19
|
+
)
|
20
|
+
result = FinalResult(
|
21
|
+
stop_reason=StopReasonType.end_turn,
|
22
|
+
usage=LettaUsageStatistics(),
|
23
|
+
)
|
24
|
+
|
25
|
+
for i in range(params.max_steps):
|
26
|
+
_ = await workflow.execute_activity(
|
27
|
+
example_activity, messages, start_to_close_timeout=timedelta(seconds=5)
|
28
|
+
)
|
29
|
+
# self._maybe_get_approval_messages
|
30
|
+
# if approval
|
31
|
+
# parse tool params from approval message
|
32
|
+
# else
|
33
|
+
# self._check_run_cancellation
|
34
|
+
# self._refresh_messages
|
35
|
+
|
36
|
+
# try:
|
37
|
+
# self.llm_client.build_request_data
|
38
|
+
# self.llm_client.request_async
|
39
|
+
# self.llm_client.convert_response_to_chat_completion
|
40
|
+
# except ContextWindowExceededError:
|
41
|
+
# self.summarize_conversation_history
|
42
|
+
# self.llm_client.build_request_data
|
43
|
+
# self.llm_client.request_async
|
44
|
+
# self.llm_client.convert_response_to_chat_completion
|
45
|
+
|
46
|
+
# self._update_global_usage_stats
|
47
|
+
# parse tool call args
|
48
|
+
# self._handle_ai_response <-- this needs to be broken up into individual pieces
|
49
|
+
# self.agent_manager.update_message_ids_async
|
50
|
+
# convert message to letta message and return
|
51
|
+
pass
|
52
|
+
|
53
|
+
# self.summarize_conversation_history
|
54
|
+
# put together final result
|
55
|
+
|
56
|
+
return result
|
@@ -0,0 +1,25 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from typing import List
|
3
|
+
from letta.schemas.agent import AgentState
|
4
|
+
from letta.schemas.letta_stop_reason import StopReasonType
|
5
|
+
from letta.schemas.message import Message, MessageCreate
|
6
|
+
from letta.schemas.usage import LettaUsageStatistics
|
7
|
+
from letta.schemas.user import User
|
8
|
+
|
9
|
+
@dataclass
|
10
|
+
class WorkflowInputParams:
|
11
|
+
agent_state: AgentState
|
12
|
+
messages: list[MessageCreate]
|
13
|
+
actor: User
|
14
|
+
max_steps: int = 50
|
15
|
+
|
16
|
+
@dataclass
|
17
|
+
class PreparedMessages:
|
18
|
+
in_context_messages: List[Message]
|
19
|
+
input_messages_to_persist: List[Message]
|
20
|
+
|
21
|
+
|
22
|
+
@dataclass
|
23
|
+
class FinalResult:
|
24
|
+
stop_reason: StopReasonType
|
25
|
+
usage: LettaUsageStatistics
|
letta/agents/voice_agent.py
CHANGED
@@ -14,8 +14,8 @@ from letta.helpers.tool_execution_helper import add_pre_execution_message, enabl
|
|
14
14
|
from letta.interfaces.openai_chat_completions_streaming_interface import OpenAIChatCompletionsStreamingInterface
|
15
15
|
from letta.log import get_logger
|
16
16
|
from letta.prompts.prompt_generator import PromptGenerator
|
17
|
-
from letta.schemas.agent import AgentState
|
18
|
-
from letta.schemas.enums import MessageRole, ToolType
|
17
|
+
from letta.schemas.agent import AgentState
|
18
|
+
from letta.schemas.enums import AgentType, MessageRole, ToolType
|
19
19
|
from letta.schemas.letta_response import LettaResponse
|
20
20
|
from letta.schemas.message import Message, MessageCreate
|
21
21
|
from letta.schemas.openai.chat_completion_request import (
|
letta/orm/agent.py
CHANGED
@@ -13,8 +13,9 @@ from letta.orm.identity import Identity
|
|
13
13
|
from letta.orm.mixins import OrganizationMixin, ProjectMixin, TemplateEntityMixin, TemplateMixin
|
14
14
|
from letta.orm.organization import Organization
|
15
15
|
from letta.orm.sqlalchemy_base import SqlalchemyBase
|
16
|
-
from letta.schemas.agent import AgentState as PydanticAgentState
|
16
|
+
from letta.schemas.agent import AgentState as PydanticAgentState
|
17
17
|
from letta.schemas.embedding_config import EmbeddingConfig
|
18
|
+
from letta.schemas.enums import AgentType
|
18
19
|
from letta.schemas.llm_config import LLMConfig
|
19
20
|
from letta.schemas.memory import Memory
|
20
21
|
from letta.schemas.response_format import ResponseFormatUnion
|
@@ -249,7 +250,7 @@ class Agent(SqlalchemyBase, OrganizationMixin, ProjectMixin, TemplateEntityMixin
|
|
249
250
|
if (block := b.to_pydantic_block(per_file_view_window_char_limit=self._get_per_file_view_window_char_limit()))
|
250
251
|
is not None
|
251
252
|
],
|
252
|
-
|
253
|
+
agent_type=self.agent_type,
|
253
254
|
),
|
254
255
|
"identity_ids": lambda: [i.id for i in self.identities],
|
255
256
|
"multi_agent_group": lambda: self.multi_agent_group,
|
@@ -366,7 +367,7 @@ class Agent(SqlalchemyBase, OrganizationMixin, ProjectMixin, TemplateEntityMixin
|
|
366
367
|
for b in file_agents
|
367
368
|
if (block := b.to_pydantic_block(per_file_view_window_char_limit=self._get_per_file_view_window_char_limit())) is not None
|
368
369
|
],
|
369
|
-
|
370
|
+
agent_type=self.agent_type,
|
370
371
|
)
|
371
372
|
state["identity_ids"] = [i.id for i in identities]
|
372
373
|
state["multi_agent_group"] = multi_agent_group
|
@@ -94,7 +94,7 @@ class PromptGenerator:
|
|
94
94
|
timezone: str,
|
95
95
|
user_defined_variables: Optional[dict] = None,
|
96
96
|
append_icm_if_missing: bool = True,
|
97
|
-
template_format: Literal["f-string", "mustache"
|
97
|
+
template_format: Literal["f-string", "mustache"] = "f-string",
|
98
98
|
previous_message_count: int = 0,
|
99
99
|
archival_memory_size: int = 0,
|
100
100
|
archive_tags: Optional[List[str]] = None,
|
@@ -150,7 +150,7 @@ class PromptGenerator:
|
|
150
150
|
raise ValueError(f"Failed to format system prompt - {str(e)}. System prompt value:\n{system_prompt}")
|
151
151
|
|
152
152
|
else:
|
153
|
-
# TODO support for mustache
|
153
|
+
# TODO support for mustache
|
154
154
|
raise NotImplementedError(template_format)
|
155
155
|
|
156
156
|
return formatted_prompt
|
@@ -164,7 +164,7 @@ class PromptGenerator:
|
|
164
164
|
timezone: str,
|
165
165
|
user_defined_variables: Optional[dict] = None,
|
166
166
|
append_icm_if_missing: bool = True,
|
167
|
-
template_format: Literal["f-string", "mustache"
|
167
|
+
template_format: Literal["f-string", "mustache"] = "f-string",
|
168
168
|
previous_message_count: int = 0,
|
169
169
|
archival_memory_size: int = 0,
|
170
170
|
tool_rules_solver: Optional[ToolRulesSolver] = None,
|
@@ -181,7 +181,7 @@ class PromptGenerator:
|
|
181
181
|
else:
|
182
182
|
pass
|
183
183
|
|
184
|
-
memory_with_sources =
|
184
|
+
memory_with_sources = in_context_memory.compile(
|
185
185
|
tool_usage_rules=tool_constraint_block, sources=sources, max_files_open=max_files_open
|
186
186
|
)
|
187
187
|
|
letta/schemas/agent.py
CHANGED
@@ -22,6 +22,8 @@ from letta.schemas.tool_rule import ToolRule
|
|
22
22
|
from letta.utils import calculate_file_defaults_based_on_context_window, create_random_username
|
23
23
|
|
24
24
|
|
25
|
+
# TODO: Remove this upon next OSS release, there's a duplicate AgentType in enums
|
26
|
+
# TODO: This is done in the interest of time to avoid needing to update the sandbox template IDs on cloud/rebuild
|
25
27
|
class AgentType(str, Enum):
|
26
28
|
"""
|
27
29
|
Enum to represent the type of agent.
|
@@ -383,196 +385,5 @@ class AgentStepResponse(BaseModel):
|
|
383
385
|
|
384
386
|
|
385
387
|
def get_prompt_template_for_agent_type(agent_type: Optional[AgentType] = None):
|
386
|
-
|
387
|
-
|
388
|
-
if agent_type == AgentType.react_agent or agent_type == AgentType.workflow_agent:
|
389
|
-
return (
|
390
|
-
"{% if sources %}"
|
391
|
-
"<directories>\n"
|
392
|
-
"{% if max_files_open %}"
|
393
|
-
"<file_limits>\n"
|
394
|
-
"- current_files_open={{ file_blocks|selectattr('value')|list|length }}\n"
|
395
|
-
"- max_files_open={{ max_files_open }}\n"
|
396
|
-
"</file_limits>\n"
|
397
|
-
"{% endif %}"
|
398
|
-
"{% for source in sources %}"
|
399
|
-
f'<directory name="{{{{ source.name }}}}">\n'
|
400
|
-
"{% if source.description %}"
|
401
|
-
"<description>{{ source.description }}</description>\n"
|
402
|
-
"{% endif %}"
|
403
|
-
"{% if source.instructions %}"
|
404
|
-
"<instructions>{{ source.instructions }}</instructions>\n"
|
405
|
-
"{% endif %}"
|
406
|
-
"{% if file_blocks %}"
|
407
|
-
"{% for block in file_blocks %}"
|
408
|
-
"{% if block.source_id and block.source_id == source.id %}"
|
409
|
-
f"<file status=\"{{{{ '{FileStatus.open.value}' if block.value else '{FileStatus.closed.value}' }}}}\">\n"
|
410
|
-
"<{{ block.label }}>\n"
|
411
|
-
"<description>\n"
|
412
|
-
"{{ block.description }}\n"
|
413
|
-
"</description>\n"
|
414
|
-
"<metadata>"
|
415
|
-
"{% if block.read_only %}\n- read_only=true{% endif %}\n"
|
416
|
-
"- chars_current={{ block.value|length }}\n"
|
417
|
-
"- chars_limit={{ block.limit }}\n"
|
418
|
-
"</metadata>\n"
|
419
|
-
"<value>\n"
|
420
|
-
"{{ block.value }}\n"
|
421
|
-
"</value>\n"
|
422
|
-
"</file>\n"
|
423
|
-
"{% endif %}"
|
424
|
-
"{% endfor %}"
|
425
|
-
"{% endif %}"
|
426
|
-
"</directory>\n"
|
427
|
-
"{% endfor %}"
|
428
|
-
"</directories>"
|
429
|
-
"{% endif %}"
|
430
|
-
)
|
431
|
-
|
432
|
-
# Sleeptime agents use the MemGPT v2 memory tools (line numbers)
|
433
|
-
# MemGPT v2 tools use line-number, so core memory blocks should have line numbers
|
434
|
-
elif agent_type == AgentType.sleeptime_agent or agent_type == AgentType.memgpt_v2_agent:
|
435
|
-
return (
|
436
|
-
"<memory_blocks>\nThe following memory blocks are currently engaged in your core memory unit:\n\n"
|
437
|
-
"{% for block in blocks %}"
|
438
|
-
"<{{ block.label }}>\n"
|
439
|
-
"<description>\n"
|
440
|
-
"{{ block.description }}\n"
|
441
|
-
"</description>\n"
|
442
|
-
"<metadata>"
|
443
|
-
"{% if block.read_only %}\n- read_only=true{% endif %}\n"
|
444
|
-
"- chars_current={{ block.value|length }}\n"
|
445
|
-
"- chars_limit={{ block.limit }}\n"
|
446
|
-
"</metadata>\n"
|
447
|
-
"<value>\n"
|
448
|
-
f"{CORE_MEMORY_LINE_NUMBER_WARNING}\n"
|
449
|
-
"{% for line in block.value.split('\\n') %}"
|
450
|
-
"Line {{ loop.index }}: {{ line }}\n"
|
451
|
-
"{% endfor %}"
|
452
|
-
"</value>\n"
|
453
|
-
"</{{ block.label }}>\n"
|
454
|
-
"{% if not loop.last %}\n{% endif %}"
|
455
|
-
"{% endfor %}"
|
456
|
-
"\n</memory_blocks>"
|
457
|
-
"\n\n{% if tool_usage_rules %}"
|
458
|
-
"<tool_usage_rules>\n"
|
459
|
-
"{{ tool_usage_rules.description }}\n\n"
|
460
|
-
"{{ tool_usage_rules.value }}\n"
|
461
|
-
"</tool_usage_rules>"
|
462
|
-
"{% endif %}"
|
463
|
-
"\n\n{% if sources %}"
|
464
|
-
"<directories>\n"
|
465
|
-
"{% if max_files_open %}"
|
466
|
-
"<file_limits>\n"
|
467
|
-
"- current_files_open={{ file_blocks|selectattr('value')|list|length }}\n"
|
468
|
-
"- max_files_open={{ max_files_open }}\n"
|
469
|
-
"</file_limits>\n"
|
470
|
-
"{% endif %}"
|
471
|
-
"{% for source in sources %}"
|
472
|
-
f'<directory name="{{{{ source.name }}}}">\n'
|
473
|
-
"{% if source.description %}"
|
474
|
-
"<description>{{ source.description }}</description>\n"
|
475
|
-
"{% endif %}"
|
476
|
-
"{% if source.instructions %}"
|
477
|
-
"<instructions>{{ source.instructions }}</instructions>\n"
|
478
|
-
"{% endif %}"
|
479
|
-
"{% if file_blocks %}"
|
480
|
-
"{% for block in file_blocks %}"
|
481
|
-
"{% if block.source_id and block.source_id == source.id %}"
|
482
|
-
f"<file status=\"{{{{ '{FileStatus.open.value}' if block.value else '{FileStatus.closed.value}' }}}}\" name=\"{{{{ block.label }}}}\">\n"
|
483
|
-
"{% if block.description %}"
|
484
|
-
"<description>\n"
|
485
|
-
"{{ block.description }}\n"
|
486
|
-
"</description>\n"
|
487
|
-
"{% endif %}"
|
488
|
-
"<metadata>"
|
489
|
-
"{% if block.read_only %}\n- read_only=true{% endif %}\n"
|
490
|
-
"- chars_current={{ block.value|length }}\n"
|
491
|
-
"- chars_limit={{ block.limit }}\n"
|
492
|
-
"</metadata>\n"
|
493
|
-
"{% if block.value %}"
|
494
|
-
"<value>\n"
|
495
|
-
"{{ block.value }}\n"
|
496
|
-
"</value>\n"
|
497
|
-
"{% endif %}"
|
498
|
-
"</file>\n"
|
499
|
-
"{% endif %}"
|
500
|
-
"{% endfor %}"
|
501
|
-
"{% endif %}"
|
502
|
-
"</directory>\n"
|
503
|
-
"{% endfor %}"
|
504
|
-
"</directories>"
|
505
|
-
"{% endif %}"
|
506
|
-
)
|
507
|
-
|
508
|
-
# All other agent types use memory blocks
|
509
|
-
else:
|
510
|
-
return (
|
511
|
-
"<memory_blocks>\nThe following memory blocks are currently engaged in your core memory unit:\n\n"
|
512
|
-
"{% for block in blocks %}"
|
513
|
-
"<{{ block.label }}>\n"
|
514
|
-
"<description>\n"
|
515
|
-
"{{ block.description }}\n"
|
516
|
-
"</description>\n"
|
517
|
-
"<metadata>"
|
518
|
-
"{% if block.read_only %}\n- read_only=true{% endif %}\n"
|
519
|
-
"- chars_current={{ block.value|length }}\n"
|
520
|
-
"- chars_limit={{ block.limit }}\n"
|
521
|
-
"</metadata>\n"
|
522
|
-
"<value>\n"
|
523
|
-
"{{ block.value }}\n"
|
524
|
-
"</value>\n"
|
525
|
-
"</{{ block.label }}>\n"
|
526
|
-
"{% if not loop.last %}\n{% endif %}"
|
527
|
-
"{% endfor %}"
|
528
|
-
"\n</memory_blocks>"
|
529
|
-
"\n\n{% if tool_usage_rules %}"
|
530
|
-
"<tool_usage_rules>\n"
|
531
|
-
"{{ tool_usage_rules.description }}\n\n"
|
532
|
-
"{{ tool_usage_rules.value }}\n"
|
533
|
-
"</tool_usage_rules>"
|
534
|
-
"{% endif %}"
|
535
|
-
"\n\n{% if sources %}"
|
536
|
-
"<directories>\n"
|
537
|
-
"{% if max_files_open %}"
|
538
|
-
"<file_limits>\n"
|
539
|
-
"- current_files_open={{ file_blocks|selectattr('value')|list|length }}\n"
|
540
|
-
"- max_files_open={{ max_files_open }}\n"
|
541
|
-
"</file_limits>\n"
|
542
|
-
"{% endif %}"
|
543
|
-
"{% for source in sources %}"
|
544
|
-
f'<directory name="{{{{ source.name }}}}">\n'
|
545
|
-
"{% if source.description %}"
|
546
|
-
"<description>{{ source.description }}</description>\n"
|
547
|
-
"{% endif %}"
|
548
|
-
"{% if source.instructions %}"
|
549
|
-
"<instructions>{{ source.instructions }}</instructions>\n"
|
550
|
-
"{% endif %}"
|
551
|
-
"{% if file_blocks %}"
|
552
|
-
"{% for block in file_blocks %}"
|
553
|
-
"{% if block.source_id and block.source_id == source.id %}"
|
554
|
-
f"<file status=\"{{{{ '{FileStatus.open.value}' if block.value else '{FileStatus.closed.value}' }}}}\" name=\"{{{{ block.label }}}}\">\n"
|
555
|
-
"{% if block.description %}"
|
556
|
-
"<description>\n"
|
557
|
-
"{{ block.description }}\n"
|
558
|
-
"</description>\n"
|
559
|
-
"{% endif %}"
|
560
|
-
"<metadata>"
|
561
|
-
"{% if block.read_only %}\n- read_only=true{% endif %}\n"
|
562
|
-
"- chars_current={{ block.value|length }}\n"
|
563
|
-
"- chars_limit={{ block.limit }}\n"
|
564
|
-
"</metadata>\n"
|
565
|
-
"{% if block.value %}"
|
566
|
-
"<value>\n"
|
567
|
-
"{{ block.value }}\n"
|
568
|
-
"</value>\n"
|
569
|
-
"{% endif %}"
|
570
|
-
"</file>\n"
|
571
|
-
"{% endif %}"
|
572
|
-
"{% endfor %}"
|
573
|
-
"{% endif %}"
|
574
|
-
"</directory>\n"
|
575
|
-
"{% endfor %}"
|
576
|
-
"</directories>"
|
577
|
-
"{% endif %}"
|
578
|
-
)
|
388
|
+
"""Deprecated. Templates are not used anymore; fast renderer handles formatting."""
|
389
|
+
return ""
|
letta/schemas/enums.py
CHANGED
@@ -21,6 +21,21 @@ class ProviderType(str, Enum):
|
|
21
21
|
xai = "xai"
|
22
22
|
|
23
23
|
|
24
|
+
class AgentType(str, Enum):
|
25
|
+
"""
|
26
|
+
Enum to represent the type of agent.
|
27
|
+
"""
|
28
|
+
|
29
|
+
memgpt_agent = "memgpt_agent" # the OG set of memgpt tools
|
30
|
+
memgpt_v2_agent = "memgpt_v2_agent" # memgpt style tools, but refreshed
|
31
|
+
react_agent = "react_agent" # basic react agent, no memory tools
|
32
|
+
workflow_agent = "workflow_agent" # workflow with auto-clearing message buffer
|
33
|
+
split_thread_agent = "split_thread_agent"
|
34
|
+
sleeptime_agent = "sleeptime_agent"
|
35
|
+
voice_convo_agent = "voice_convo_agent"
|
36
|
+
voice_sleeptime_agent = "voice_sleeptime_agent"
|
37
|
+
|
38
|
+
|
24
39
|
class ProviderCategory(str, Enum):
|
25
40
|
base = "base"
|
26
41
|
byok = "byok"
|