letta-client 1.0.0a9__py3-none-any.whl → 1.0.0a11__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.
Potentially problematic release.
This version of letta-client might be problematic. Click here for more details.
- letta_client/_client.py +5 -1
- letta_client/_streaming.py +40 -2
- letta_client/_version.py +1 -1
- letta_client/resources/agents/agents.py +396 -396
- letta_client/resources/agents/blocks.py +198 -190
- letta_client/resources/agents/files.py +10 -13
- letta_client/resources/agents/folders.py +10 -13
- letta_client/resources/agents/messages.py +380 -370
- letta_client/resources/agents/tools.py +10 -13
- letta_client/resources/archives.py +111 -113
- letta_client/resources/batches/batches.py +10 -12
- letta_client/resources/batches/messages.py +11 -14
- letta_client/resources/blocks/blocks.py +238 -222
- letta_client/resources/folders/agents.py +10 -13
- letta_client/resources/folders/files.py +9 -12
- letta_client/resources/folders/folders.py +143 -145
- letta_client/resources/groups/groups.py +141 -141
- letta_client/resources/groups/messages.py +198 -198
- letta_client/resources/identities/blocks.py +7 -7
- letta_client/resources/identities/identities.py +151 -153
- letta_client/resources/runs/runs.py +11 -13
- letta_client/resources/tags.py +10 -13
- letta_client/resources/tools.py +802 -204
- letta_client/types/__init__.py +14 -7
- letta_client/types/{agent_update_params.py → agent_modify_params.py} +2 -2
- letta_client/types/agent_state.py +6 -3
- letta_client/types/agents/__init__.py +5 -3
- letta_client/types/agents/block.py +6 -3
- letta_client/types/agents/{block_update_params.py → block_modify_params.py} +8 -5
- letta_client/types/agents/file_list_response.py +14 -3
- letta_client/types/agents/folder_list_response.py +7 -3
- letta_client/types/agents/letta_streaming_response.py +70 -0
- letta_client/types/agents/{message_update_params.py → message_modify_params.py} +2 -2
- letta_client/types/agents/{message_update_response.py → message_modify_response.py} +2 -2
- letta_client/types/agents/tool_list_response.py +10 -0
- letta_client/types/archive_list_response.py +10 -0
- letta_client/types/{archive_update_params.py → archive_modify_params.py} +2 -2
- letta_client/types/batch_list_response.py +10 -0
- letta_client/types/batches/__init__.py +1 -0
- letta_client/types/batches/message_list_response.py +12 -0
- letta_client/types/block_create_params.py +6 -3
- letta_client/types/{block_update_params.py → block_modify_params.py} +8 -5
- letta_client/types/block_response.py +63 -0
- letta_client/types/create_block_param.py +6 -3
- letta_client/types/folder_list_response.py +10 -0
- letta_client/types/{folder_update_params.py → folder_modify_params.py} +2 -2
- letta_client/types/folders/agent_list_response.py +2 -1
- letta_client/types/folders/file_list_response.py +7 -4
- letta_client/types/{group_update_params.py → group_modify_params.py} +2 -2
- letta_client/types/groups/__init__.py +2 -2
- letta_client/types/groups/{message_update_params.py → message_modify_params.py} +2 -2
- letta_client/types/groups/{message_update_response.py → message_modify_response.py} +2 -2
- letta_client/types/identity_list_response.py +10 -0
- letta_client/types/{identity_update_params.py → identity_modify_params.py} +2 -2
- letta_client/types/run_list_response.py +10 -0
- letta_client/types/tag_list_response.py +2 -1
- letta_client/types/tool.py +106 -2
- letta_client/types/tool_list_response.py +10 -0
- letta_client/types/{tool_update_params.py → tool_modify_params.py} +2 -2
- {letta_client-1.0.0a9.dist-info → letta_client-1.0.0a11.dist-info}/METADATA +1 -1
- {letta_client-1.0.0a9.dist-info → letta_client-1.0.0a11.dist-info}/RECORD +63 -53
- {letta_client-1.0.0a9.dist-info → letta_client-1.0.0a11.dist-info}/WHEEL +0 -0
- {letta_client-1.0.0a9.dist-info → letta_client-1.0.0a11.dist-info}/licenses/LICENSE +0 -0
|
@@ -44,7 +44,7 @@ from ...types import (
|
|
|
44
44
|
AgentType,
|
|
45
45
|
agent_list_params,
|
|
46
46
|
agent_create_params,
|
|
47
|
-
|
|
47
|
+
agent_modify_params,
|
|
48
48
|
agent_retrieve_params,
|
|
49
49
|
agent_export_file_params,
|
|
50
50
|
agent_import_file_params,
|
|
@@ -441,185 +441,6 @@ class AgentsResource(SyncAPIResource):
|
|
|
441
441
|
cast_to=AgentState,
|
|
442
442
|
)
|
|
443
443
|
|
|
444
|
-
def update(
|
|
445
|
-
self,
|
|
446
|
-
agent_id: str,
|
|
447
|
-
*,
|
|
448
|
-
base_template_id: Optional[str] | Omit = omit,
|
|
449
|
-
block_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
450
|
-
context_window_limit: Optional[int] | Omit = omit,
|
|
451
|
-
description: Optional[str] | Omit = omit,
|
|
452
|
-
embedding: Optional[str] | Omit = omit,
|
|
453
|
-
embedding_config: Optional[EmbeddingConfigParam] | Omit = omit,
|
|
454
|
-
enable_sleeptime: Optional[bool] | Omit = omit,
|
|
455
|
-
hidden: Optional[bool] | Omit = omit,
|
|
456
|
-
identity_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
457
|
-
last_run_completion: Union[str, datetime, None] | Omit = omit,
|
|
458
|
-
last_run_duration_ms: Optional[int] | Omit = omit,
|
|
459
|
-
llm_config: Optional[LlmConfigParam] | Omit = omit,
|
|
460
|
-
max_files_open: Optional[int] | Omit = omit,
|
|
461
|
-
max_tokens: Optional[int] | Omit = omit,
|
|
462
|
-
message_buffer_autoclear: Optional[bool] | Omit = omit,
|
|
463
|
-
message_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
464
|
-
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
465
|
-
model: Optional[str] | Omit = omit,
|
|
466
|
-
name: Optional[str] | Omit = omit,
|
|
467
|
-
parallel_tool_calls: Optional[bool] | Omit = omit,
|
|
468
|
-
per_file_view_window_char_limit: Optional[int] | Omit = omit,
|
|
469
|
-
project_id: Optional[str] | Omit = omit,
|
|
470
|
-
reasoning: Optional[bool] | Omit = omit,
|
|
471
|
-
response_format: Optional[agent_update_params.ResponseFormat] | Omit = omit,
|
|
472
|
-
secrets: Optional[Dict[str, str]] | Omit = omit,
|
|
473
|
-
source_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
474
|
-
system: Optional[str] | Omit = omit,
|
|
475
|
-
tags: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
476
|
-
template_id: Optional[str] | Omit = omit,
|
|
477
|
-
timezone: Optional[str] | Omit = omit,
|
|
478
|
-
tool_exec_environment_variables: Optional[Dict[str, str]] | Omit = omit,
|
|
479
|
-
tool_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
480
|
-
tool_rules: Optional[Iterable[agent_update_params.ToolRule]] | Omit = omit,
|
|
481
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
482
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
483
|
-
extra_headers: Headers | None = None,
|
|
484
|
-
extra_query: Query | None = None,
|
|
485
|
-
extra_body: Body | None = None,
|
|
486
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
487
|
-
) -> AgentState:
|
|
488
|
-
"""
|
|
489
|
-
Update an existing agent.
|
|
490
|
-
|
|
491
|
-
Args:
|
|
492
|
-
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
493
|
-
|
|
494
|
-
base_template_id: The base template id of the agent.
|
|
495
|
-
|
|
496
|
-
block_ids: The ids of the blocks used by the agent.
|
|
497
|
-
|
|
498
|
-
context_window_limit: The context window limit used by the agent.
|
|
499
|
-
|
|
500
|
-
description: The description of the agent.
|
|
501
|
-
|
|
502
|
-
embedding: The embedding configuration handle used by the agent, specified in the format
|
|
503
|
-
provider/model-name.
|
|
504
|
-
|
|
505
|
-
embedding_config: Configuration for embedding model connection and processing parameters.
|
|
506
|
-
|
|
507
|
-
enable_sleeptime: If set to True, memory management will move to a background agent thread.
|
|
508
|
-
|
|
509
|
-
hidden: If set to True, the agent will be hidden.
|
|
510
|
-
|
|
511
|
-
identity_ids: The ids of the identities associated with this agent.
|
|
512
|
-
|
|
513
|
-
last_run_completion: The timestamp when the agent last completed a run.
|
|
514
|
-
|
|
515
|
-
last_run_duration_ms: The duration in milliseconds of the agent's last run.
|
|
516
|
-
|
|
517
|
-
llm_config: Configuration for Language Model (LLM) connection and generation parameters.
|
|
518
|
-
|
|
519
|
-
max_files_open: Maximum number of files that can be open at once for this agent. Setting this
|
|
520
|
-
too high may exceed the context window, which will break the agent.
|
|
521
|
-
|
|
522
|
-
max_tokens: The maximum number of tokens to generate, including reasoning step. If not set,
|
|
523
|
-
the model will use its default value.
|
|
524
|
-
|
|
525
|
-
message_buffer_autoclear: If set to True, the agent will not remember previous messages (though the agent
|
|
526
|
-
will still retain state via core memory blocks and archival/recall memory). Not
|
|
527
|
-
recommended unless you have an advanced use case.
|
|
528
|
-
|
|
529
|
-
message_ids: The ids of the messages in the agent's in-context memory.
|
|
530
|
-
|
|
531
|
-
metadata: The metadata of the agent.
|
|
532
|
-
|
|
533
|
-
model: The LLM configuration handle used by the agent, specified in the format
|
|
534
|
-
provider/model-name, as an alternative to specifying llm_config.
|
|
535
|
-
|
|
536
|
-
name: The name of the agent.
|
|
537
|
-
|
|
538
|
-
parallel_tool_calls: If set to True, enables parallel tool calling. Defaults to False.
|
|
539
|
-
|
|
540
|
-
per_file_view_window_char_limit: The per-file view window character limit for this agent. Setting this too high
|
|
541
|
-
may exceed the context window, which will break the agent.
|
|
542
|
-
|
|
543
|
-
project_id: The id of the project the agent belongs to.
|
|
544
|
-
|
|
545
|
-
reasoning: Whether to enable reasoning for this agent.
|
|
546
|
-
|
|
547
|
-
response_format: The response format for the agent.
|
|
548
|
-
|
|
549
|
-
secrets: The environment variables for tool execution specific to this agent.
|
|
550
|
-
|
|
551
|
-
source_ids: The ids of the sources used by the agent.
|
|
552
|
-
|
|
553
|
-
system: The system prompt used by the agent.
|
|
554
|
-
|
|
555
|
-
tags: The tags associated with the agent.
|
|
556
|
-
|
|
557
|
-
template_id: The id of the template the agent belongs to.
|
|
558
|
-
|
|
559
|
-
timezone: The timezone of the agent (IANA format).
|
|
560
|
-
|
|
561
|
-
tool_exec_environment_variables: Deprecated: use `secrets` field instead
|
|
562
|
-
|
|
563
|
-
tool_ids: The ids of the tools used by the agent.
|
|
564
|
-
|
|
565
|
-
tool_rules: The tool rules governing the agent.
|
|
566
|
-
|
|
567
|
-
extra_headers: Send extra headers
|
|
568
|
-
|
|
569
|
-
extra_query: Add additional query parameters to the request
|
|
570
|
-
|
|
571
|
-
extra_body: Add additional JSON properties to the request
|
|
572
|
-
|
|
573
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
574
|
-
"""
|
|
575
|
-
if not agent_id:
|
|
576
|
-
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
577
|
-
return self._patch(
|
|
578
|
-
f"/v1/agents/{agent_id}",
|
|
579
|
-
body=maybe_transform(
|
|
580
|
-
{
|
|
581
|
-
"base_template_id": base_template_id,
|
|
582
|
-
"block_ids": block_ids,
|
|
583
|
-
"context_window_limit": context_window_limit,
|
|
584
|
-
"description": description,
|
|
585
|
-
"embedding": embedding,
|
|
586
|
-
"embedding_config": embedding_config,
|
|
587
|
-
"enable_sleeptime": enable_sleeptime,
|
|
588
|
-
"hidden": hidden,
|
|
589
|
-
"identity_ids": identity_ids,
|
|
590
|
-
"last_run_completion": last_run_completion,
|
|
591
|
-
"last_run_duration_ms": last_run_duration_ms,
|
|
592
|
-
"llm_config": llm_config,
|
|
593
|
-
"max_files_open": max_files_open,
|
|
594
|
-
"max_tokens": max_tokens,
|
|
595
|
-
"message_buffer_autoclear": message_buffer_autoclear,
|
|
596
|
-
"message_ids": message_ids,
|
|
597
|
-
"metadata": metadata,
|
|
598
|
-
"model": model,
|
|
599
|
-
"name": name,
|
|
600
|
-
"parallel_tool_calls": parallel_tool_calls,
|
|
601
|
-
"per_file_view_window_char_limit": per_file_view_window_char_limit,
|
|
602
|
-
"project_id": project_id,
|
|
603
|
-
"reasoning": reasoning,
|
|
604
|
-
"response_format": response_format,
|
|
605
|
-
"secrets": secrets,
|
|
606
|
-
"source_ids": source_ids,
|
|
607
|
-
"system": system,
|
|
608
|
-
"tags": tags,
|
|
609
|
-
"template_id": template_id,
|
|
610
|
-
"timezone": timezone,
|
|
611
|
-
"tool_exec_environment_variables": tool_exec_environment_variables,
|
|
612
|
-
"tool_ids": tool_ids,
|
|
613
|
-
"tool_rules": tool_rules,
|
|
614
|
-
},
|
|
615
|
-
agent_update_params.AgentUpdateParams,
|
|
616
|
-
),
|
|
617
|
-
options=make_request_options(
|
|
618
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
619
|
-
),
|
|
620
|
-
cast_to=AgentState,
|
|
621
|
-
)
|
|
622
|
-
|
|
623
444
|
def list(
|
|
624
445
|
self,
|
|
625
446
|
*,
|
|
@@ -933,100 +754,43 @@ class AgentsResource(SyncAPIResource):
|
|
|
933
754
|
cast_to=AgentImportFileResponse,
|
|
934
755
|
)
|
|
935
756
|
|
|
936
|
-
|
|
937
|
-
class AsyncAgentsResource(AsyncAPIResource):
|
|
938
|
-
@cached_property
|
|
939
|
-
def tools(self) -> AsyncToolsResource:
|
|
940
|
-
return AsyncToolsResource(self._client)
|
|
941
|
-
|
|
942
|
-
@cached_property
|
|
943
|
-
def folders(self) -> AsyncFoldersResource:
|
|
944
|
-
return AsyncFoldersResource(self._client)
|
|
945
|
-
|
|
946
|
-
@cached_property
|
|
947
|
-
def files(self) -> AsyncFilesResource:
|
|
948
|
-
return AsyncFilesResource(self._client)
|
|
949
|
-
|
|
950
|
-
@cached_property
|
|
951
|
-
def blocks(self) -> AsyncBlocksResource:
|
|
952
|
-
return AsyncBlocksResource(self._client)
|
|
953
|
-
|
|
954
|
-
@cached_property
|
|
955
|
-
def groups(self) -> AsyncGroupsResource:
|
|
956
|
-
return AsyncGroupsResource(self._client)
|
|
957
|
-
|
|
958
|
-
@cached_property
|
|
959
|
-
def messages(self) -> AsyncMessagesResource:
|
|
960
|
-
return AsyncMessagesResource(self._client)
|
|
961
|
-
|
|
962
|
-
@cached_property
|
|
963
|
-
def with_raw_response(self) -> AsyncAgentsResourceWithRawResponse:
|
|
964
|
-
"""
|
|
965
|
-
This property can be used as a prefix for any HTTP method call to return
|
|
966
|
-
the raw response object instead of the parsed content.
|
|
967
|
-
|
|
968
|
-
For more information, see https://www.github.com/letta-ai/letta-python#accessing-raw-response-data-eg-headers
|
|
969
|
-
"""
|
|
970
|
-
return AsyncAgentsResourceWithRawResponse(self)
|
|
971
|
-
|
|
972
|
-
@cached_property
|
|
973
|
-
def with_streaming_response(self) -> AsyncAgentsResourceWithStreamingResponse:
|
|
974
|
-
"""
|
|
975
|
-
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
976
|
-
|
|
977
|
-
For more information, see https://www.github.com/letta-ai/letta-python#with_streaming_response
|
|
978
|
-
"""
|
|
979
|
-
return AsyncAgentsResourceWithStreamingResponse(self)
|
|
980
|
-
|
|
981
|
-
async def create(
|
|
757
|
+
def modify(
|
|
982
758
|
self,
|
|
759
|
+
agent_id: str,
|
|
983
760
|
*,
|
|
984
|
-
agent_type: AgentType | Omit = omit,
|
|
985
761
|
base_template_id: Optional[str] | Omit = omit,
|
|
986
762
|
block_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
987
763
|
context_window_limit: Optional[int] | Omit = omit,
|
|
988
764
|
description: Optional[str] | Omit = omit,
|
|
989
765
|
embedding: Optional[str] | Omit = omit,
|
|
990
|
-
embedding_chunk_size: Optional[int] | Omit = omit,
|
|
991
766
|
embedding_config: Optional[EmbeddingConfigParam] | Omit = omit,
|
|
992
|
-
enable_reasoner: Optional[bool] | Omit = omit,
|
|
993
767
|
enable_sleeptime: Optional[bool] | Omit = omit,
|
|
994
|
-
from_template: Optional[str] | Omit = omit,
|
|
995
768
|
hidden: Optional[bool] | Omit = omit,
|
|
996
769
|
identity_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
include_default_source: bool | Omit = omit,
|
|
1000
|
-
include_multi_agent_tools: bool | Omit = omit,
|
|
1001
|
-
initial_message_sequence: Optional[Iterable[MessageCreateParam]] | Omit = omit,
|
|
770
|
+
last_run_completion: Union[str, datetime, None] | Omit = omit,
|
|
771
|
+
last_run_duration_ms: Optional[int] | Omit = omit,
|
|
1002
772
|
llm_config: Optional[LlmConfigParam] | Omit = omit,
|
|
1003
773
|
max_files_open: Optional[int] | Omit = omit,
|
|
1004
|
-
max_reasoning_tokens: Optional[int] | Omit = omit,
|
|
1005
774
|
max_tokens: Optional[int] | Omit = omit,
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
message_buffer_autoclear: bool | Omit = omit,
|
|
775
|
+
message_buffer_autoclear: Optional[bool] | Omit = omit,
|
|
776
|
+
message_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1009
777
|
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
1010
778
|
model: Optional[str] | Omit = omit,
|
|
1011
|
-
name: str | Omit = omit,
|
|
779
|
+
name: Optional[str] | Omit = omit,
|
|
1012
780
|
parallel_tool_calls: Optional[bool] | Omit = omit,
|
|
1013
781
|
per_file_view_window_char_limit: Optional[int] | Omit = omit,
|
|
1014
|
-
project: Optional[str] | Omit = omit,
|
|
1015
782
|
project_id: Optional[str] | Omit = omit,
|
|
1016
783
|
reasoning: Optional[bool] | Omit = omit,
|
|
1017
|
-
response_format: Optional[
|
|
784
|
+
response_format: Optional[agent_modify_params.ResponseFormat] | Omit = omit,
|
|
1018
785
|
secrets: Optional[Dict[str, str]] | Omit = omit,
|
|
1019
786
|
source_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1020
787
|
system: Optional[str] | Omit = omit,
|
|
1021
788
|
tags: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1022
|
-
template: bool | Omit = omit,
|
|
1023
789
|
template_id: Optional[str] | Omit = omit,
|
|
1024
790
|
timezone: Optional[str] | Omit = omit,
|
|
1025
791
|
tool_exec_environment_variables: Optional[Dict[str, str]] | Omit = omit,
|
|
1026
792
|
tool_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1027
|
-
tool_rules: Optional[Iterable[
|
|
1028
|
-
tools: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1029
|
-
x_project: str | Omit = omit,
|
|
793
|
+
tool_rules: Optional[Iterable[agent_modify_params.ToolRule]] | Omit = omit,
|
|
1030
794
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1031
795
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1032
796
|
extra_headers: Headers | None = None,
|
|
@@ -1035,10 +799,10 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1035
799
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1036
800
|
) -> AgentState:
|
|
1037
801
|
"""
|
|
1038
|
-
|
|
802
|
+
Update an existing agent.
|
|
1039
803
|
|
|
1040
804
|
Args:
|
|
1041
|
-
|
|
805
|
+
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
1042
806
|
|
|
1043
807
|
base_template_id: The base template id of the agent.
|
|
1044
808
|
|
|
@@ -1051,52 +815,32 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1051
815
|
embedding: The embedding configuration handle used by the agent, specified in the format
|
|
1052
816
|
provider/model-name.
|
|
1053
817
|
|
|
1054
|
-
embedding_chunk_size: The embedding chunk size used by the agent.
|
|
1055
|
-
|
|
1056
818
|
embedding_config: Configuration for embedding model connection and processing parameters.
|
|
1057
819
|
|
|
1058
|
-
enable_reasoner: Whether to enable internal extended thinking step for a reasoner model.
|
|
1059
|
-
|
|
1060
820
|
enable_sleeptime: If set to True, memory management will move to a background agent thread.
|
|
1061
821
|
|
|
1062
|
-
from_template: Deprecated: please use the 'create agents from a template' endpoint instead.
|
|
1063
|
-
|
|
1064
822
|
hidden: If set to True, the agent will be hidden.
|
|
1065
823
|
|
|
1066
824
|
identity_ids: The ids of the identities associated with this agent.
|
|
1067
825
|
|
|
1068
|
-
|
|
1069
|
-
allowed).
|
|
1070
|
-
|
|
1071
|
-
include_base_tools: If true, attaches the Letta core tools (e.g. core_memory related functions).
|
|
1072
|
-
|
|
1073
|
-
include_default_source: If true, automatically creates and attaches a default data source for this
|
|
1074
|
-
agent.
|
|
1075
|
-
|
|
1076
|
-
include_multi_agent_tools: If true, attaches the Letta multi-agent tools (e.g. sending a message to another
|
|
1077
|
-
agent).
|
|
826
|
+
last_run_completion: The timestamp when the agent last completed a run.
|
|
1078
827
|
|
|
1079
|
-
|
|
828
|
+
last_run_duration_ms: The duration in milliseconds of the agent's last run.
|
|
1080
829
|
|
|
1081
830
|
llm_config: Configuration for Language Model (LLM) connection and generation parameters.
|
|
1082
831
|
|
|
1083
832
|
max_files_open: Maximum number of files that can be open at once for this agent. Setting this
|
|
1084
833
|
too high may exceed the context window, which will break the agent.
|
|
1085
834
|
|
|
1086
|
-
max_reasoning_tokens: The maximum number of tokens to generate for reasoning step. If not set, the
|
|
1087
|
-
model will use its default value.
|
|
1088
|
-
|
|
1089
835
|
max_tokens: The maximum number of tokens to generate, including reasoning step. If not set,
|
|
1090
836
|
the model will use its default value.
|
|
1091
837
|
|
|
1092
|
-
memory_blocks: The blocks to create in the agent's in-context memory.
|
|
1093
|
-
|
|
1094
|
-
memory_variables: The variables that should be set for the agent.
|
|
1095
|
-
|
|
1096
838
|
message_buffer_autoclear: If set to True, the agent will not remember previous messages (though the agent
|
|
1097
839
|
will still retain state via core memory blocks and archival/recall memory). Not
|
|
1098
840
|
recommended unless you have an advanced use case.
|
|
1099
841
|
|
|
842
|
+
message_ids: The ids of the messages in the agent's in-context memory.
|
|
843
|
+
|
|
1100
844
|
metadata: The metadata of the agent.
|
|
1101
845
|
|
|
1102
846
|
model: The LLM configuration handle used by the agent, specified in the format
|
|
@@ -1109,10 +853,6 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1109
853
|
per_file_view_window_char_limit: The per-file view window character limit for this agent. Setting this too high
|
|
1110
854
|
may exceed the context window, which will break the agent.
|
|
1111
855
|
|
|
1112
|
-
project: Deprecated: Project should now be passed via the X-Project header instead of in
|
|
1113
|
-
the request body. If using the sdk, this can be done via the new x_project field
|
|
1114
|
-
below.
|
|
1115
|
-
|
|
1116
856
|
project_id: The id of the project the agent belongs to.
|
|
1117
857
|
|
|
1118
858
|
reasoning: Whether to enable reasoning for this agent.
|
|
@@ -1127,22 +867,16 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1127
867
|
|
|
1128
868
|
tags: The tags associated with the agent.
|
|
1129
869
|
|
|
1130
|
-
template: Deprecated: No longer used
|
|
1131
|
-
|
|
1132
870
|
template_id: The id of the template the agent belongs to.
|
|
1133
871
|
|
|
1134
872
|
timezone: The timezone of the agent (IANA format).
|
|
1135
873
|
|
|
1136
|
-
tool_exec_environment_variables: Deprecated: use `secrets` field instead
|
|
874
|
+
tool_exec_environment_variables: Deprecated: use `secrets` field instead
|
|
1137
875
|
|
|
1138
876
|
tool_ids: The ids of the tools used by the agent.
|
|
1139
877
|
|
|
1140
878
|
tool_rules: The tool rules governing the agent.
|
|
1141
879
|
|
|
1142
|
-
tools: The tools used by the agent.
|
|
1143
|
-
|
|
1144
|
-
x_project: The project slug to associate with the agent (cloud only).
|
|
1145
|
-
|
|
1146
880
|
extra_headers: Send extra headers
|
|
1147
881
|
|
|
1148
882
|
extra_query: Add additional query parameters to the request
|
|
@@ -1151,42 +885,33 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1151
885
|
|
|
1152
886
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
1153
887
|
"""
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
888
|
+
if not agent_id:
|
|
889
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
890
|
+
return self._patch(
|
|
891
|
+
f"/v1/agents/{agent_id}",
|
|
892
|
+
body=maybe_transform(
|
|
1158
893
|
{
|
|
1159
|
-
"agent_type": agent_type,
|
|
1160
894
|
"base_template_id": base_template_id,
|
|
1161
895
|
"block_ids": block_ids,
|
|
1162
896
|
"context_window_limit": context_window_limit,
|
|
1163
897
|
"description": description,
|
|
1164
898
|
"embedding": embedding,
|
|
1165
|
-
"embedding_chunk_size": embedding_chunk_size,
|
|
1166
899
|
"embedding_config": embedding_config,
|
|
1167
|
-
"enable_reasoner": enable_reasoner,
|
|
1168
900
|
"enable_sleeptime": enable_sleeptime,
|
|
1169
|
-
"from_template": from_template,
|
|
1170
901
|
"hidden": hidden,
|
|
1171
902
|
"identity_ids": identity_ids,
|
|
1172
|
-
"
|
|
1173
|
-
"
|
|
1174
|
-
"include_default_source": include_default_source,
|
|
1175
|
-
"include_multi_agent_tools": include_multi_agent_tools,
|
|
1176
|
-
"initial_message_sequence": initial_message_sequence,
|
|
903
|
+
"last_run_completion": last_run_completion,
|
|
904
|
+
"last_run_duration_ms": last_run_duration_ms,
|
|
1177
905
|
"llm_config": llm_config,
|
|
1178
906
|
"max_files_open": max_files_open,
|
|
1179
|
-
"max_reasoning_tokens": max_reasoning_tokens,
|
|
1180
907
|
"max_tokens": max_tokens,
|
|
1181
|
-
"memory_blocks": memory_blocks,
|
|
1182
|
-
"memory_variables": memory_variables,
|
|
1183
908
|
"message_buffer_autoclear": message_buffer_autoclear,
|
|
909
|
+
"message_ids": message_ids,
|
|
1184
910
|
"metadata": metadata,
|
|
1185
911
|
"model": model,
|
|
1186
912
|
"name": name,
|
|
1187
913
|
"parallel_tool_calls": parallel_tool_calls,
|
|
1188
914
|
"per_file_view_window_char_limit": per_file_view_window_char_limit,
|
|
1189
|
-
"project": project,
|
|
1190
915
|
"project_id": project_id,
|
|
1191
916
|
"reasoning": reasoning,
|
|
1192
917
|
"response_format": response_format,
|
|
@@ -1194,15 +919,13 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1194
919
|
"source_ids": source_ids,
|
|
1195
920
|
"system": system,
|
|
1196
921
|
"tags": tags,
|
|
1197
|
-
"template": template,
|
|
1198
922
|
"template_id": template_id,
|
|
1199
923
|
"timezone": timezone,
|
|
1200
924
|
"tool_exec_environment_variables": tool_exec_environment_variables,
|
|
1201
925
|
"tool_ids": tool_ids,
|
|
1202
926
|
"tool_rules": tool_rules,
|
|
1203
|
-
"tools": tools,
|
|
1204
927
|
},
|
|
1205
|
-
|
|
928
|
+
agent_modify_params.AgentModifyParams,
|
|
1206
929
|
),
|
|
1207
930
|
options=make_request_options(
|
|
1208
931
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
@@ -1210,109 +933,100 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1210
933
|
cast_to=AgentState,
|
|
1211
934
|
)
|
|
1212
935
|
|
|
1213
|
-
async def retrieve(
|
|
1214
|
-
self,
|
|
1215
|
-
agent_id: str,
|
|
1216
|
-
*,
|
|
1217
|
-
include: List[
|
|
1218
|
-
Literal[
|
|
1219
|
-
"agent.blocks",
|
|
1220
|
-
"agent.identities",
|
|
1221
|
-
"agent.managed_group",
|
|
1222
|
-
"agent.secrets",
|
|
1223
|
-
"agent.sources",
|
|
1224
|
-
"agent.tags",
|
|
1225
|
-
"agent.tools",
|
|
1226
|
-
]
|
|
1227
|
-
]
|
|
1228
|
-
| Omit = omit,
|
|
1229
|
-
include_relationships: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1230
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1231
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1232
|
-
extra_headers: Headers | None = None,
|
|
1233
|
-
extra_query: Query | None = None,
|
|
1234
|
-
extra_body: Body | None = None,
|
|
1235
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1236
|
-
) -> AgentState:
|
|
1237
|
-
"""
|
|
1238
|
-
Get the state of the agent.
|
|
1239
936
|
|
|
1240
|
-
|
|
1241
|
-
|
|
937
|
+
class AsyncAgentsResource(AsyncAPIResource):
|
|
938
|
+
@cached_property
|
|
939
|
+
def tools(self) -> AsyncToolsResource:
|
|
940
|
+
return AsyncToolsResource(self._client)
|
|
1242
941
|
|
|
1243
|
-
|
|
1244
|
-
|
|
942
|
+
@cached_property
|
|
943
|
+
def folders(self) -> AsyncFoldersResource:
|
|
944
|
+
return AsyncFoldersResource(self._client)
|
|
1245
945
|
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
parameter, and no longer supported after 1.0.0 SDK versions.
|
|
946
|
+
@cached_property
|
|
947
|
+
def files(self) -> AsyncFilesResource:
|
|
948
|
+
return AsyncFilesResource(self._client)
|
|
1250
949
|
|
|
1251
|
-
|
|
950
|
+
@cached_property
|
|
951
|
+
def blocks(self) -> AsyncBlocksResource:
|
|
952
|
+
return AsyncBlocksResource(self._client)
|
|
1252
953
|
|
|
1253
|
-
|
|
954
|
+
@cached_property
|
|
955
|
+
def groups(self) -> AsyncGroupsResource:
|
|
956
|
+
return AsyncGroupsResource(self._client)
|
|
1254
957
|
|
|
1255
|
-
|
|
958
|
+
@cached_property
|
|
959
|
+
def messages(self) -> AsyncMessagesResource:
|
|
960
|
+
return AsyncMessagesResource(self._client)
|
|
1256
961
|
|
|
1257
|
-
|
|
962
|
+
@cached_property
|
|
963
|
+
def with_raw_response(self) -> AsyncAgentsResourceWithRawResponse:
|
|
1258
964
|
"""
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
"include": include,
|
|
1271
|
-
"include_relationships": include_relationships,
|
|
1272
|
-
},
|
|
1273
|
-
agent_retrieve_params.AgentRetrieveParams,
|
|
1274
|
-
),
|
|
1275
|
-
),
|
|
1276
|
-
cast_to=AgentState,
|
|
1277
|
-
)
|
|
965
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
966
|
+
the raw response object instead of the parsed content.
|
|
967
|
+
|
|
968
|
+
For more information, see https://www.github.com/letta-ai/letta-python#accessing-raw-response-data-eg-headers
|
|
969
|
+
"""
|
|
970
|
+
return AsyncAgentsResourceWithRawResponse(self)
|
|
971
|
+
|
|
972
|
+
@cached_property
|
|
973
|
+
def with_streaming_response(self) -> AsyncAgentsResourceWithStreamingResponse:
|
|
974
|
+
"""
|
|
975
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
1278
976
|
|
|
1279
|
-
|
|
977
|
+
For more information, see https://www.github.com/letta-ai/letta-python#with_streaming_response
|
|
978
|
+
"""
|
|
979
|
+
return AsyncAgentsResourceWithStreamingResponse(self)
|
|
980
|
+
|
|
981
|
+
async def create(
|
|
1280
982
|
self,
|
|
1281
|
-
agent_id: str,
|
|
1282
983
|
*,
|
|
984
|
+
agent_type: AgentType | Omit = omit,
|
|
1283
985
|
base_template_id: Optional[str] | Omit = omit,
|
|
1284
986
|
block_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1285
987
|
context_window_limit: Optional[int] | Omit = omit,
|
|
1286
988
|
description: Optional[str] | Omit = omit,
|
|
1287
989
|
embedding: Optional[str] | Omit = omit,
|
|
990
|
+
embedding_chunk_size: Optional[int] | Omit = omit,
|
|
1288
991
|
embedding_config: Optional[EmbeddingConfigParam] | Omit = omit,
|
|
992
|
+
enable_reasoner: Optional[bool] | Omit = omit,
|
|
1289
993
|
enable_sleeptime: Optional[bool] | Omit = omit,
|
|
994
|
+
from_template: Optional[str] | Omit = omit,
|
|
1290
995
|
hidden: Optional[bool] | Omit = omit,
|
|
1291
996
|
identity_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1292
|
-
|
|
1293
|
-
|
|
997
|
+
include_base_tool_rules: Optional[bool] | Omit = omit,
|
|
998
|
+
include_base_tools: bool | Omit = omit,
|
|
999
|
+
include_default_source: bool | Omit = omit,
|
|
1000
|
+
include_multi_agent_tools: bool | Omit = omit,
|
|
1001
|
+
initial_message_sequence: Optional[Iterable[MessageCreateParam]] | Omit = omit,
|
|
1294
1002
|
llm_config: Optional[LlmConfigParam] | Omit = omit,
|
|
1295
1003
|
max_files_open: Optional[int] | Omit = omit,
|
|
1004
|
+
max_reasoning_tokens: Optional[int] | Omit = omit,
|
|
1296
1005
|
max_tokens: Optional[int] | Omit = omit,
|
|
1297
|
-
|
|
1298
|
-
|
|
1006
|
+
memory_blocks: Optional[Iterable[CreateBlockParam]] | Omit = omit,
|
|
1007
|
+
memory_variables: Optional[Dict[str, str]] | Omit = omit,
|
|
1008
|
+
message_buffer_autoclear: bool | Omit = omit,
|
|
1299
1009
|
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
1300
1010
|
model: Optional[str] | Omit = omit,
|
|
1301
|
-
name:
|
|
1011
|
+
name: str | Omit = omit,
|
|
1302
1012
|
parallel_tool_calls: Optional[bool] | Omit = omit,
|
|
1303
1013
|
per_file_view_window_char_limit: Optional[int] | Omit = omit,
|
|
1014
|
+
project: Optional[str] | Omit = omit,
|
|
1304
1015
|
project_id: Optional[str] | Omit = omit,
|
|
1305
1016
|
reasoning: Optional[bool] | Omit = omit,
|
|
1306
|
-
response_format: Optional[
|
|
1017
|
+
response_format: Optional[agent_create_params.ResponseFormat] | Omit = omit,
|
|
1307
1018
|
secrets: Optional[Dict[str, str]] | Omit = omit,
|
|
1308
1019
|
source_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1309
1020
|
system: Optional[str] | Omit = omit,
|
|
1310
1021
|
tags: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1022
|
+
template: bool | Omit = omit,
|
|
1311
1023
|
template_id: Optional[str] | Omit = omit,
|
|
1312
1024
|
timezone: Optional[str] | Omit = omit,
|
|
1313
1025
|
tool_exec_environment_variables: Optional[Dict[str, str]] | Omit = omit,
|
|
1314
1026
|
tool_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1315
|
-
tool_rules: Optional[Iterable[
|
|
1027
|
+
tool_rules: Optional[Iterable[agent_create_params.ToolRule]] | Omit = omit,
|
|
1028
|
+
tools: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1029
|
+
x_project: str | Omit = omit,
|
|
1316
1030
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1317
1031
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1318
1032
|
extra_headers: Headers | None = None,
|
|
@@ -1321,10 +1035,10 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1321
1035
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1322
1036
|
) -> AgentState:
|
|
1323
1037
|
"""
|
|
1324
|
-
|
|
1038
|
+
Create an agent.
|
|
1325
1039
|
|
|
1326
1040
|
Args:
|
|
1327
|
-
|
|
1041
|
+
agent_type: The type of agent.
|
|
1328
1042
|
|
|
1329
1043
|
base_template_id: The base template id of the agent.
|
|
1330
1044
|
|
|
@@ -1337,32 +1051,52 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1337
1051
|
embedding: The embedding configuration handle used by the agent, specified in the format
|
|
1338
1052
|
provider/model-name.
|
|
1339
1053
|
|
|
1054
|
+
embedding_chunk_size: The embedding chunk size used by the agent.
|
|
1055
|
+
|
|
1340
1056
|
embedding_config: Configuration for embedding model connection and processing parameters.
|
|
1341
1057
|
|
|
1058
|
+
enable_reasoner: Whether to enable internal extended thinking step for a reasoner model.
|
|
1059
|
+
|
|
1342
1060
|
enable_sleeptime: If set to True, memory management will move to a background agent thread.
|
|
1343
1061
|
|
|
1062
|
+
from_template: Deprecated: please use the 'create agents from a template' endpoint instead.
|
|
1063
|
+
|
|
1344
1064
|
hidden: If set to True, the agent will be hidden.
|
|
1345
1065
|
|
|
1346
1066
|
identity_ids: The ids of the identities associated with this agent.
|
|
1347
1067
|
|
|
1348
|
-
|
|
1068
|
+
include_base_tool_rules: If true, attaches the Letta base tool rules (e.g. deny all tools not explicitly
|
|
1069
|
+
allowed).
|
|
1349
1070
|
|
|
1350
|
-
|
|
1071
|
+
include_base_tools: If true, attaches the Letta core tools (e.g. core_memory related functions).
|
|
1072
|
+
|
|
1073
|
+
include_default_source: If true, automatically creates and attaches a default data source for this
|
|
1074
|
+
agent.
|
|
1075
|
+
|
|
1076
|
+
include_multi_agent_tools: If true, attaches the Letta multi-agent tools (e.g. sending a message to another
|
|
1077
|
+
agent).
|
|
1078
|
+
|
|
1079
|
+
initial_message_sequence: The initial set of messages to put in the agent's in-context memory.
|
|
1351
1080
|
|
|
1352
1081
|
llm_config: Configuration for Language Model (LLM) connection and generation parameters.
|
|
1353
1082
|
|
|
1354
1083
|
max_files_open: Maximum number of files that can be open at once for this agent. Setting this
|
|
1355
1084
|
too high may exceed the context window, which will break the agent.
|
|
1356
1085
|
|
|
1086
|
+
max_reasoning_tokens: The maximum number of tokens to generate for reasoning step. If not set, the
|
|
1087
|
+
model will use its default value.
|
|
1088
|
+
|
|
1357
1089
|
max_tokens: The maximum number of tokens to generate, including reasoning step. If not set,
|
|
1358
1090
|
the model will use its default value.
|
|
1359
1091
|
|
|
1092
|
+
memory_blocks: The blocks to create in the agent's in-context memory.
|
|
1093
|
+
|
|
1094
|
+
memory_variables: The variables that should be set for the agent.
|
|
1095
|
+
|
|
1360
1096
|
message_buffer_autoclear: If set to True, the agent will not remember previous messages (though the agent
|
|
1361
1097
|
will still retain state via core memory blocks and archival/recall memory). Not
|
|
1362
1098
|
recommended unless you have an advanced use case.
|
|
1363
1099
|
|
|
1364
|
-
message_ids: The ids of the messages in the agent's in-context memory.
|
|
1365
|
-
|
|
1366
1100
|
metadata: The metadata of the agent.
|
|
1367
1101
|
|
|
1368
1102
|
model: The LLM configuration handle used by the agent, specified in the format
|
|
@@ -1375,6 +1109,10 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1375
1109
|
per_file_view_window_char_limit: The per-file view window character limit for this agent. Setting this too high
|
|
1376
1110
|
may exceed the context window, which will break the agent.
|
|
1377
1111
|
|
|
1112
|
+
project: Deprecated: Project should now be passed via the X-Project header instead of in
|
|
1113
|
+
the request body. If using the sdk, this can be done via the new x_project field
|
|
1114
|
+
below.
|
|
1115
|
+
|
|
1378
1116
|
project_id: The id of the project the agent belongs to.
|
|
1379
1117
|
|
|
1380
1118
|
reasoning: Whether to enable reasoning for this agent.
|
|
@@ -1389,16 +1127,22 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1389
1127
|
|
|
1390
1128
|
tags: The tags associated with the agent.
|
|
1391
1129
|
|
|
1130
|
+
template: Deprecated: No longer used
|
|
1131
|
+
|
|
1392
1132
|
template_id: The id of the template the agent belongs to.
|
|
1393
1133
|
|
|
1394
1134
|
timezone: The timezone of the agent (IANA format).
|
|
1395
1135
|
|
|
1396
|
-
tool_exec_environment_variables: Deprecated: use `secrets` field instead
|
|
1136
|
+
tool_exec_environment_variables: Deprecated: use `secrets` field instead.
|
|
1397
1137
|
|
|
1398
1138
|
tool_ids: The ids of the tools used by the agent.
|
|
1399
1139
|
|
|
1400
1140
|
tool_rules: The tool rules governing the agent.
|
|
1401
1141
|
|
|
1142
|
+
tools: The tools used by the agent.
|
|
1143
|
+
|
|
1144
|
+
x_project: The project slug to associate with the agent (cloud only).
|
|
1145
|
+
|
|
1402
1146
|
extra_headers: Send extra headers
|
|
1403
1147
|
|
|
1404
1148
|
extra_query: Add additional query parameters to the request
|
|
@@ -1407,33 +1151,42 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1407
1151
|
|
|
1408
1152
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
1409
1153
|
"""
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
f"/v1/agents/{agent_id}",
|
|
1154
|
+
extra_headers = {**strip_not_given({"X-Project": x_project}), **(extra_headers or {})}
|
|
1155
|
+
return await self._post(
|
|
1156
|
+
"/v1/agents/",
|
|
1414
1157
|
body=await async_maybe_transform(
|
|
1415
1158
|
{
|
|
1159
|
+
"agent_type": agent_type,
|
|
1416
1160
|
"base_template_id": base_template_id,
|
|
1417
1161
|
"block_ids": block_ids,
|
|
1418
1162
|
"context_window_limit": context_window_limit,
|
|
1419
1163
|
"description": description,
|
|
1420
1164
|
"embedding": embedding,
|
|
1165
|
+
"embedding_chunk_size": embedding_chunk_size,
|
|
1421
1166
|
"embedding_config": embedding_config,
|
|
1167
|
+
"enable_reasoner": enable_reasoner,
|
|
1422
1168
|
"enable_sleeptime": enable_sleeptime,
|
|
1169
|
+
"from_template": from_template,
|
|
1423
1170
|
"hidden": hidden,
|
|
1424
1171
|
"identity_ids": identity_ids,
|
|
1425
|
-
"
|
|
1426
|
-
"
|
|
1172
|
+
"include_base_tool_rules": include_base_tool_rules,
|
|
1173
|
+
"include_base_tools": include_base_tools,
|
|
1174
|
+
"include_default_source": include_default_source,
|
|
1175
|
+
"include_multi_agent_tools": include_multi_agent_tools,
|
|
1176
|
+
"initial_message_sequence": initial_message_sequence,
|
|
1427
1177
|
"llm_config": llm_config,
|
|
1428
1178
|
"max_files_open": max_files_open,
|
|
1179
|
+
"max_reasoning_tokens": max_reasoning_tokens,
|
|
1429
1180
|
"max_tokens": max_tokens,
|
|
1181
|
+
"memory_blocks": memory_blocks,
|
|
1182
|
+
"memory_variables": memory_variables,
|
|
1430
1183
|
"message_buffer_autoclear": message_buffer_autoclear,
|
|
1431
|
-
"message_ids": message_ids,
|
|
1432
1184
|
"metadata": metadata,
|
|
1433
1185
|
"model": model,
|
|
1434
1186
|
"name": name,
|
|
1435
1187
|
"parallel_tool_calls": parallel_tool_calls,
|
|
1436
1188
|
"per_file_view_window_char_limit": per_file_view_window_char_limit,
|
|
1189
|
+
"project": project,
|
|
1437
1190
|
"project_id": project_id,
|
|
1438
1191
|
"reasoning": reasoning,
|
|
1439
1192
|
"response_format": response_format,
|
|
@@ -1441,13 +1194,15 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1441
1194
|
"source_ids": source_ids,
|
|
1442
1195
|
"system": system,
|
|
1443
1196
|
"tags": tags,
|
|
1197
|
+
"template": template,
|
|
1444
1198
|
"template_id": template_id,
|
|
1445
1199
|
"timezone": timezone,
|
|
1446
1200
|
"tool_exec_environment_variables": tool_exec_environment_variables,
|
|
1447
1201
|
"tool_ids": tool_ids,
|
|
1448
1202
|
"tool_rules": tool_rules,
|
|
1203
|
+
"tools": tools,
|
|
1449
1204
|
},
|
|
1450
|
-
|
|
1205
|
+
agent_create_params.AgentCreateParams,
|
|
1451
1206
|
),
|
|
1452
1207
|
options=make_request_options(
|
|
1453
1208
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
@@ -1455,6 +1210,72 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1455
1210
|
cast_to=AgentState,
|
|
1456
1211
|
)
|
|
1457
1212
|
|
|
1213
|
+
async def retrieve(
|
|
1214
|
+
self,
|
|
1215
|
+
agent_id: str,
|
|
1216
|
+
*,
|
|
1217
|
+
include: List[
|
|
1218
|
+
Literal[
|
|
1219
|
+
"agent.blocks",
|
|
1220
|
+
"agent.identities",
|
|
1221
|
+
"agent.managed_group",
|
|
1222
|
+
"agent.secrets",
|
|
1223
|
+
"agent.sources",
|
|
1224
|
+
"agent.tags",
|
|
1225
|
+
"agent.tools",
|
|
1226
|
+
]
|
|
1227
|
+
]
|
|
1228
|
+
| Omit = omit,
|
|
1229
|
+
include_relationships: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1230
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1231
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1232
|
+
extra_headers: Headers | None = None,
|
|
1233
|
+
extra_query: Query | None = None,
|
|
1234
|
+
extra_body: Body | None = None,
|
|
1235
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1236
|
+
) -> AgentState:
|
|
1237
|
+
"""
|
|
1238
|
+
Get the state of the agent.
|
|
1239
|
+
|
|
1240
|
+
Args:
|
|
1241
|
+
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
1242
|
+
|
|
1243
|
+
include: Specify which relational fields to include in the response. No relationships are
|
|
1244
|
+
included by default.
|
|
1245
|
+
|
|
1246
|
+
include_relationships: Specify which relational fields (e.g., 'tools', 'sources', 'memory') to include
|
|
1247
|
+
in the response. If not provided, all relationships are loaded by default. Using
|
|
1248
|
+
this can optimize performance by reducing unnecessary joins.This is a legacy
|
|
1249
|
+
parameter, and no longer supported after 1.0.0 SDK versions.
|
|
1250
|
+
|
|
1251
|
+
extra_headers: Send extra headers
|
|
1252
|
+
|
|
1253
|
+
extra_query: Add additional query parameters to the request
|
|
1254
|
+
|
|
1255
|
+
extra_body: Add additional JSON properties to the request
|
|
1256
|
+
|
|
1257
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1258
|
+
"""
|
|
1259
|
+
if not agent_id:
|
|
1260
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
1261
|
+
return await self._get(
|
|
1262
|
+
f"/v1/agents/{agent_id}",
|
|
1263
|
+
options=make_request_options(
|
|
1264
|
+
extra_headers=extra_headers,
|
|
1265
|
+
extra_query=extra_query,
|
|
1266
|
+
extra_body=extra_body,
|
|
1267
|
+
timeout=timeout,
|
|
1268
|
+
query=await async_maybe_transform(
|
|
1269
|
+
{
|
|
1270
|
+
"include": include,
|
|
1271
|
+
"include_relationships": include_relationships,
|
|
1272
|
+
},
|
|
1273
|
+
agent_retrieve_params.AgentRetrieveParams,
|
|
1274
|
+
),
|
|
1275
|
+
),
|
|
1276
|
+
cast_to=AgentState,
|
|
1277
|
+
)
|
|
1278
|
+
|
|
1458
1279
|
def list(
|
|
1459
1280
|
self,
|
|
1460
1281
|
*,
|
|
@@ -1768,6 +1589,185 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1768
1589
|
cast_to=AgentImportFileResponse,
|
|
1769
1590
|
)
|
|
1770
1591
|
|
|
1592
|
+
async def modify(
|
|
1593
|
+
self,
|
|
1594
|
+
agent_id: str,
|
|
1595
|
+
*,
|
|
1596
|
+
base_template_id: Optional[str] | Omit = omit,
|
|
1597
|
+
block_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1598
|
+
context_window_limit: Optional[int] | Omit = omit,
|
|
1599
|
+
description: Optional[str] | Omit = omit,
|
|
1600
|
+
embedding: Optional[str] | Omit = omit,
|
|
1601
|
+
embedding_config: Optional[EmbeddingConfigParam] | Omit = omit,
|
|
1602
|
+
enable_sleeptime: Optional[bool] | Omit = omit,
|
|
1603
|
+
hidden: Optional[bool] | Omit = omit,
|
|
1604
|
+
identity_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1605
|
+
last_run_completion: Union[str, datetime, None] | Omit = omit,
|
|
1606
|
+
last_run_duration_ms: Optional[int] | Omit = omit,
|
|
1607
|
+
llm_config: Optional[LlmConfigParam] | Omit = omit,
|
|
1608
|
+
max_files_open: Optional[int] | Omit = omit,
|
|
1609
|
+
max_tokens: Optional[int] | Omit = omit,
|
|
1610
|
+
message_buffer_autoclear: Optional[bool] | Omit = omit,
|
|
1611
|
+
message_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1612
|
+
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
1613
|
+
model: Optional[str] | Omit = omit,
|
|
1614
|
+
name: Optional[str] | Omit = omit,
|
|
1615
|
+
parallel_tool_calls: Optional[bool] | Omit = omit,
|
|
1616
|
+
per_file_view_window_char_limit: Optional[int] | Omit = omit,
|
|
1617
|
+
project_id: Optional[str] | Omit = omit,
|
|
1618
|
+
reasoning: Optional[bool] | Omit = omit,
|
|
1619
|
+
response_format: Optional[agent_modify_params.ResponseFormat] | Omit = omit,
|
|
1620
|
+
secrets: Optional[Dict[str, str]] | Omit = omit,
|
|
1621
|
+
source_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1622
|
+
system: Optional[str] | Omit = omit,
|
|
1623
|
+
tags: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1624
|
+
template_id: Optional[str] | Omit = omit,
|
|
1625
|
+
timezone: Optional[str] | Omit = omit,
|
|
1626
|
+
tool_exec_environment_variables: Optional[Dict[str, str]] | Omit = omit,
|
|
1627
|
+
tool_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1628
|
+
tool_rules: Optional[Iterable[agent_modify_params.ToolRule]] | Omit = omit,
|
|
1629
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1630
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1631
|
+
extra_headers: Headers | None = None,
|
|
1632
|
+
extra_query: Query | None = None,
|
|
1633
|
+
extra_body: Body | None = None,
|
|
1634
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1635
|
+
) -> AgentState:
|
|
1636
|
+
"""
|
|
1637
|
+
Update an existing agent.
|
|
1638
|
+
|
|
1639
|
+
Args:
|
|
1640
|
+
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
1641
|
+
|
|
1642
|
+
base_template_id: The base template id of the agent.
|
|
1643
|
+
|
|
1644
|
+
block_ids: The ids of the blocks used by the agent.
|
|
1645
|
+
|
|
1646
|
+
context_window_limit: The context window limit used by the agent.
|
|
1647
|
+
|
|
1648
|
+
description: The description of the agent.
|
|
1649
|
+
|
|
1650
|
+
embedding: The embedding configuration handle used by the agent, specified in the format
|
|
1651
|
+
provider/model-name.
|
|
1652
|
+
|
|
1653
|
+
embedding_config: Configuration for embedding model connection and processing parameters.
|
|
1654
|
+
|
|
1655
|
+
enable_sleeptime: If set to True, memory management will move to a background agent thread.
|
|
1656
|
+
|
|
1657
|
+
hidden: If set to True, the agent will be hidden.
|
|
1658
|
+
|
|
1659
|
+
identity_ids: The ids of the identities associated with this agent.
|
|
1660
|
+
|
|
1661
|
+
last_run_completion: The timestamp when the agent last completed a run.
|
|
1662
|
+
|
|
1663
|
+
last_run_duration_ms: The duration in milliseconds of the agent's last run.
|
|
1664
|
+
|
|
1665
|
+
llm_config: Configuration for Language Model (LLM) connection and generation parameters.
|
|
1666
|
+
|
|
1667
|
+
max_files_open: Maximum number of files that can be open at once for this agent. Setting this
|
|
1668
|
+
too high may exceed the context window, which will break the agent.
|
|
1669
|
+
|
|
1670
|
+
max_tokens: The maximum number of tokens to generate, including reasoning step. If not set,
|
|
1671
|
+
the model will use its default value.
|
|
1672
|
+
|
|
1673
|
+
message_buffer_autoclear: If set to True, the agent will not remember previous messages (though the agent
|
|
1674
|
+
will still retain state via core memory blocks and archival/recall memory). Not
|
|
1675
|
+
recommended unless you have an advanced use case.
|
|
1676
|
+
|
|
1677
|
+
message_ids: The ids of the messages in the agent's in-context memory.
|
|
1678
|
+
|
|
1679
|
+
metadata: The metadata of the agent.
|
|
1680
|
+
|
|
1681
|
+
model: The LLM configuration handle used by the agent, specified in the format
|
|
1682
|
+
provider/model-name, as an alternative to specifying llm_config.
|
|
1683
|
+
|
|
1684
|
+
name: The name of the agent.
|
|
1685
|
+
|
|
1686
|
+
parallel_tool_calls: If set to True, enables parallel tool calling. Defaults to False.
|
|
1687
|
+
|
|
1688
|
+
per_file_view_window_char_limit: The per-file view window character limit for this agent. Setting this too high
|
|
1689
|
+
may exceed the context window, which will break the agent.
|
|
1690
|
+
|
|
1691
|
+
project_id: The id of the project the agent belongs to.
|
|
1692
|
+
|
|
1693
|
+
reasoning: Whether to enable reasoning for this agent.
|
|
1694
|
+
|
|
1695
|
+
response_format: The response format for the agent.
|
|
1696
|
+
|
|
1697
|
+
secrets: The environment variables for tool execution specific to this agent.
|
|
1698
|
+
|
|
1699
|
+
source_ids: The ids of the sources used by the agent.
|
|
1700
|
+
|
|
1701
|
+
system: The system prompt used by the agent.
|
|
1702
|
+
|
|
1703
|
+
tags: The tags associated with the agent.
|
|
1704
|
+
|
|
1705
|
+
template_id: The id of the template the agent belongs to.
|
|
1706
|
+
|
|
1707
|
+
timezone: The timezone of the agent (IANA format).
|
|
1708
|
+
|
|
1709
|
+
tool_exec_environment_variables: Deprecated: use `secrets` field instead
|
|
1710
|
+
|
|
1711
|
+
tool_ids: The ids of the tools used by the agent.
|
|
1712
|
+
|
|
1713
|
+
tool_rules: The tool rules governing the agent.
|
|
1714
|
+
|
|
1715
|
+
extra_headers: Send extra headers
|
|
1716
|
+
|
|
1717
|
+
extra_query: Add additional query parameters to the request
|
|
1718
|
+
|
|
1719
|
+
extra_body: Add additional JSON properties to the request
|
|
1720
|
+
|
|
1721
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1722
|
+
"""
|
|
1723
|
+
if not agent_id:
|
|
1724
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
1725
|
+
return await self._patch(
|
|
1726
|
+
f"/v1/agents/{agent_id}",
|
|
1727
|
+
body=await async_maybe_transform(
|
|
1728
|
+
{
|
|
1729
|
+
"base_template_id": base_template_id,
|
|
1730
|
+
"block_ids": block_ids,
|
|
1731
|
+
"context_window_limit": context_window_limit,
|
|
1732
|
+
"description": description,
|
|
1733
|
+
"embedding": embedding,
|
|
1734
|
+
"embedding_config": embedding_config,
|
|
1735
|
+
"enable_sleeptime": enable_sleeptime,
|
|
1736
|
+
"hidden": hidden,
|
|
1737
|
+
"identity_ids": identity_ids,
|
|
1738
|
+
"last_run_completion": last_run_completion,
|
|
1739
|
+
"last_run_duration_ms": last_run_duration_ms,
|
|
1740
|
+
"llm_config": llm_config,
|
|
1741
|
+
"max_files_open": max_files_open,
|
|
1742
|
+
"max_tokens": max_tokens,
|
|
1743
|
+
"message_buffer_autoclear": message_buffer_autoclear,
|
|
1744
|
+
"message_ids": message_ids,
|
|
1745
|
+
"metadata": metadata,
|
|
1746
|
+
"model": model,
|
|
1747
|
+
"name": name,
|
|
1748
|
+
"parallel_tool_calls": parallel_tool_calls,
|
|
1749
|
+
"per_file_view_window_char_limit": per_file_view_window_char_limit,
|
|
1750
|
+
"project_id": project_id,
|
|
1751
|
+
"reasoning": reasoning,
|
|
1752
|
+
"response_format": response_format,
|
|
1753
|
+
"secrets": secrets,
|
|
1754
|
+
"source_ids": source_ids,
|
|
1755
|
+
"system": system,
|
|
1756
|
+
"tags": tags,
|
|
1757
|
+
"template_id": template_id,
|
|
1758
|
+
"timezone": timezone,
|
|
1759
|
+
"tool_exec_environment_variables": tool_exec_environment_variables,
|
|
1760
|
+
"tool_ids": tool_ids,
|
|
1761
|
+
"tool_rules": tool_rules,
|
|
1762
|
+
},
|
|
1763
|
+
agent_modify_params.AgentModifyParams,
|
|
1764
|
+
),
|
|
1765
|
+
options=make_request_options(
|
|
1766
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1767
|
+
),
|
|
1768
|
+
cast_to=AgentState,
|
|
1769
|
+
)
|
|
1770
|
+
|
|
1771
1771
|
|
|
1772
1772
|
class AgentsResourceWithRawResponse:
|
|
1773
1773
|
def __init__(self, agents: AgentsResource) -> None:
|
|
@@ -1779,9 +1779,6 @@ class AgentsResourceWithRawResponse:
|
|
|
1779
1779
|
self.retrieve = to_raw_response_wrapper(
|
|
1780
1780
|
agents.retrieve,
|
|
1781
1781
|
)
|
|
1782
|
-
self.update = to_raw_response_wrapper(
|
|
1783
|
-
agents.update,
|
|
1784
|
-
)
|
|
1785
1782
|
self.list = to_raw_response_wrapper(
|
|
1786
1783
|
agents.list,
|
|
1787
1784
|
)
|
|
@@ -1797,6 +1794,9 @@ class AgentsResourceWithRawResponse:
|
|
|
1797
1794
|
self.import_file = to_raw_response_wrapper(
|
|
1798
1795
|
agents.import_file,
|
|
1799
1796
|
)
|
|
1797
|
+
self.modify = to_raw_response_wrapper(
|
|
1798
|
+
agents.modify,
|
|
1799
|
+
)
|
|
1800
1800
|
|
|
1801
1801
|
@cached_property
|
|
1802
1802
|
def tools(self) -> ToolsResourceWithRawResponse:
|
|
@@ -1833,9 +1833,6 @@ class AsyncAgentsResourceWithRawResponse:
|
|
|
1833
1833
|
self.retrieve = async_to_raw_response_wrapper(
|
|
1834
1834
|
agents.retrieve,
|
|
1835
1835
|
)
|
|
1836
|
-
self.update = async_to_raw_response_wrapper(
|
|
1837
|
-
agents.update,
|
|
1838
|
-
)
|
|
1839
1836
|
self.list = async_to_raw_response_wrapper(
|
|
1840
1837
|
agents.list,
|
|
1841
1838
|
)
|
|
@@ -1851,6 +1848,9 @@ class AsyncAgentsResourceWithRawResponse:
|
|
|
1851
1848
|
self.import_file = async_to_raw_response_wrapper(
|
|
1852
1849
|
agents.import_file,
|
|
1853
1850
|
)
|
|
1851
|
+
self.modify = async_to_raw_response_wrapper(
|
|
1852
|
+
agents.modify,
|
|
1853
|
+
)
|
|
1854
1854
|
|
|
1855
1855
|
@cached_property
|
|
1856
1856
|
def tools(self) -> AsyncToolsResourceWithRawResponse:
|
|
@@ -1887,9 +1887,6 @@ class AgentsResourceWithStreamingResponse:
|
|
|
1887
1887
|
self.retrieve = to_streamed_response_wrapper(
|
|
1888
1888
|
agents.retrieve,
|
|
1889
1889
|
)
|
|
1890
|
-
self.update = to_streamed_response_wrapper(
|
|
1891
|
-
agents.update,
|
|
1892
|
-
)
|
|
1893
1890
|
self.list = to_streamed_response_wrapper(
|
|
1894
1891
|
agents.list,
|
|
1895
1892
|
)
|
|
@@ -1905,6 +1902,9 @@ class AgentsResourceWithStreamingResponse:
|
|
|
1905
1902
|
self.import_file = to_streamed_response_wrapper(
|
|
1906
1903
|
agents.import_file,
|
|
1907
1904
|
)
|
|
1905
|
+
self.modify = to_streamed_response_wrapper(
|
|
1906
|
+
agents.modify,
|
|
1907
|
+
)
|
|
1908
1908
|
|
|
1909
1909
|
@cached_property
|
|
1910
1910
|
def tools(self) -> ToolsResourceWithStreamingResponse:
|
|
@@ -1941,9 +1941,6 @@ class AsyncAgentsResourceWithStreamingResponse:
|
|
|
1941
1941
|
self.retrieve = async_to_streamed_response_wrapper(
|
|
1942
1942
|
agents.retrieve,
|
|
1943
1943
|
)
|
|
1944
|
-
self.update = async_to_streamed_response_wrapper(
|
|
1945
|
-
agents.update,
|
|
1946
|
-
)
|
|
1947
1944
|
self.list = async_to_streamed_response_wrapper(
|
|
1948
1945
|
agents.list,
|
|
1949
1946
|
)
|
|
@@ -1959,6 +1956,9 @@ class AsyncAgentsResourceWithStreamingResponse:
|
|
|
1959
1956
|
self.import_file = async_to_streamed_response_wrapper(
|
|
1960
1957
|
agents.import_file,
|
|
1961
1958
|
)
|
|
1959
|
+
self.modify = async_to_streamed_response_wrapper(
|
|
1960
|
+
agents.modify,
|
|
1961
|
+
)
|
|
1962
1962
|
|
|
1963
1963
|
@cached_property
|
|
1964
1964
|
def tools(self) -> AsyncToolsResourceWithStreamingResponse:
|