letta-client 0.1.64__py3-none-any.whl → 0.1.66__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/__init__.py +100 -0
- letta_client/agents/__init__.py +36 -0
- letta_client/agents/messages/client.py +0 -6
- letta_client/agents/types/__init__.py +68 -0
- letta_client/agents/types/agents_search_response_agents_item.py +2 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group.py +14 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_agent_ids.py +37 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_agent_ids_manager_agent_id.py +13 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_agent_ids_manager_agent_id_item.py +5 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_agent_ids_manager_type.py +7 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_agent_ids_max_turns.py +13 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_agent_ids_max_turns_item.py +5 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_agent_ids_termination_token.py +13 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_agent_ids_termination_token_item.py +5 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_item.py +10 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_item_agent_ids.py +37 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_item_agent_ids_manager_agent_id.py +13 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_item_agent_ids_manager_agent_id_item.py +5 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_item_agent_ids_manager_type.py +7 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_item_agent_ids_max_turns.py +13 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_item_agent_ids_max_turns_item.py +5 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_item_agent_ids_termination_token.py +13 -0
- letta_client/agents/types/agents_search_response_agents_item_multi_agent_group_item_agent_ids_termination_token_item.py +5 -0
- letta_client/agents/types/agents_search_response_agents_item_tools_item_tool_type.py +7 -1
- letta_client/base_client.py +4 -0
- letta_client/core/client_wrapper.py +1 -1
- letta_client/groups/__init__.py +2 -0
- letta_client/groups/client.py +1294 -0
- letta_client/templates/__init__.py +36 -0
- letta_client/templates/types/__init__.py +72 -0
- letta_client/templates/types/templates_create_agents_response_agents_item.py +4 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group.py +16 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_agent_ids.py +41 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_agent_ids_manager_agent_id.py +13 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_agent_ids_manager_agent_id_item.py +7 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_agent_ids_manager_type.py +7 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_agent_ids_max_turns.py +13 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_agent_ids_max_turns_item.py +5 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_agent_ids_termination_token.py +13 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_agent_ids_termination_token_item.py +7 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_item.py +10 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_item_agent_ids.py +41 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_item_agent_ids_manager_agent_id.py +13 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_item_agent_ids_manager_agent_id_item.py +7 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_item_agent_ids_manager_type.py +7 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_item_agent_ids_max_turns.py +13 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_item_agent_ids_max_turns_item.py +7 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_item_agent_ids_termination_token.py +15 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_multi_agent_group_item_agent_ids_termination_token_item.py +7 -0
- letta_client/templates/types/templates_create_agents_response_agents_item_tools_item_tool_type.py +7 -1
- letta_client/tools/__init__.py +3 -0
- letta_client/tools/client.py +372 -0
- letta_client/tools/types/__init__.py +5 -0
- letta_client/tools/types/list_mcp_servers_response_value.py +7 -0
- letta_client/types/__init__.py +24 -0
- letta_client/types/agent_state.py +6 -0
- letta_client/types/dynamic_manager.py +33 -0
- letta_client/types/group.py +53 -0
- letta_client/types/group_create.py +33 -0
- letta_client/types/group_create_manager_config.py +8 -0
- letta_client/types/letta_streaming_request.py +43 -0
- letta_client/types/local_server_config.py +34 -0
- letta_client/types/manager_type.py +5 -0
- letta_client/types/mcp_server_type.py +5 -0
- letta_client/types/mcp_tool.py +29 -0
- letta_client/types/message.py +5 -0
- letta_client/types/round_robin_manager.py +23 -0
- letta_client/types/sse_server_config.py +29 -0
- letta_client/types/supervisor_manager.py +23 -0
- letta_client/types/tool_type.py +7 -1
- {letta_client-0.1.64.dist-info → letta_client-0.1.66.dist-info}/METADATA +1 -1
- {letta_client-0.1.64.dist-info → letta_client-0.1.66.dist-info}/RECORD +73 -21
- {letta_client-0.1.64.dist-info → letta_client-0.1.66.dist-info}/WHEEL +0 -0
letta_client/tools/client.py
CHANGED
|
@@ -13,6 +13,8 @@ from ..core.api_error import ApiError
|
|
|
13
13
|
from ..types.tool_return_message import ToolReturnMessage
|
|
14
14
|
from ..types.app_model import AppModel
|
|
15
15
|
from ..types.action_model import ActionModel
|
|
16
|
+
from .types.list_mcp_servers_response_value import ListMcpServersResponseValue
|
|
17
|
+
from ..types.mcp_tool import McpTool
|
|
16
18
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
17
19
|
|
|
18
20
|
# this is used as the default value for optional parameters
|
|
@@ -816,6 +818,179 @@ class ToolsClient:
|
|
|
816
818
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
817
819
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
818
820
|
|
|
821
|
+
def list_mcp_servers(
|
|
822
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
823
|
+
) -> typing.Dict[str, ListMcpServersResponseValue]:
|
|
824
|
+
"""
|
|
825
|
+
Get a list of all configured MCP servers
|
|
826
|
+
|
|
827
|
+
Parameters
|
|
828
|
+
----------
|
|
829
|
+
request_options : typing.Optional[RequestOptions]
|
|
830
|
+
Request-specific configuration.
|
|
831
|
+
|
|
832
|
+
Returns
|
|
833
|
+
-------
|
|
834
|
+
typing.Dict[str, ListMcpServersResponseValue]
|
|
835
|
+
Successful Response
|
|
836
|
+
|
|
837
|
+
Examples
|
|
838
|
+
--------
|
|
839
|
+
from letta_client import Letta
|
|
840
|
+
|
|
841
|
+
client = Letta(
|
|
842
|
+
token="YOUR_TOKEN",
|
|
843
|
+
)
|
|
844
|
+
client.tools.list_mcp_servers()
|
|
845
|
+
"""
|
|
846
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
847
|
+
"v1/tools/mcp/servers",
|
|
848
|
+
method="GET",
|
|
849
|
+
request_options=request_options,
|
|
850
|
+
)
|
|
851
|
+
try:
|
|
852
|
+
if 200 <= _response.status_code < 300:
|
|
853
|
+
return typing.cast(
|
|
854
|
+
typing.Dict[str, ListMcpServersResponseValue],
|
|
855
|
+
construct_type(
|
|
856
|
+
type_=typing.Dict[str, ListMcpServersResponseValue], # type: ignore
|
|
857
|
+
object_=_response.json(),
|
|
858
|
+
),
|
|
859
|
+
)
|
|
860
|
+
if _response.status_code == 422:
|
|
861
|
+
raise UnprocessableEntityError(
|
|
862
|
+
typing.cast(
|
|
863
|
+
HttpValidationError,
|
|
864
|
+
construct_type(
|
|
865
|
+
type_=HttpValidationError, # type: ignore
|
|
866
|
+
object_=_response.json(),
|
|
867
|
+
),
|
|
868
|
+
)
|
|
869
|
+
)
|
|
870
|
+
_response_json = _response.json()
|
|
871
|
+
except JSONDecodeError:
|
|
872
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
873
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
874
|
+
|
|
875
|
+
def list_mcp_tools_by_server(
|
|
876
|
+
self, mcp_server_name: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
877
|
+
) -> typing.List[McpTool]:
|
|
878
|
+
"""
|
|
879
|
+
Get a list of all tools for a specific MCP server
|
|
880
|
+
|
|
881
|
+
Parameters
|
|
882
|
+
----------
|
|
883
|
+
mcp_server_name : str
|
|
884
|
+
|
|
885
|
+
request_options : typing.Optional[RequestOptions]
|
|
886
|
+
Request-specific configuration.
|
|
887
|
+
|
|
888
|
+
Returns
|
|
889
|
+
-------
|
|
890
|
+
typing.List[McpTool]
|
|
891
|
+
Successful Response
|
|
892
|
+
|
|
893
|
+
Examples
|
|
894
|
+
--------
|
|
895
|
+
from letta_client import Letta
|
|
896
|
+
|
|
897
|
+
client = Letta(
|
|
898
|
+
token="YOUR_TOKEN",
|
|
899
|
+
)
|
|
900
|
+
client.tools.list_mcp_tools_by_server(
|
|
901
|
+
mcp_server_name="mcp_server_name",
|
|
902
|
+
)
|
|
903
|
+
"""
|
|
904
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
905
|
+
f"v1/tools/mcp/servers/{jsonable_encoder(mcp_server_name)}/tools",
|
|
906
|
+
method="GET",
|
|
907
|
+
request_options=request_options,
|
|
908
|
+
)
|
|
909
|
+
try:
|
|
910
|
+
if 200 <= _response.status_code < 300:
|
|
911
|
+
return typing.cast(
|
|
912
|
+
typing.List[McpTool],
|
|
913
|
+
construct_type(
|
|
914
|
+
type_=typing.List[McpTool], # type: ignore
|
|
915
|
+
object_=_response.json(),
|
|
916
|
+
),
|
|
917
|
+
)
|
|
918
|
+
if _response.status_code == 422:
|
|
919
|
+
raise UnprocessableEntityError(
|
|
920
|
+
typing.cast(
|
|
921
|
+
HttpValidationError,
|
|
922
|
+
construct_type(
|
|
923
|
+
type_=HttpValidationError, # type: ignore
|
|
924
|
+
object_=_response.json(),
|
|
925
|
+
),
|
|
926
|
+
)
|
|
927
|
+
)
|
|
928
|
+
_response_json = _response.json()
|
|
929
|
+
except JSONDecodeError:
|
|
930
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
931
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
932
|
+
|
|
933
|
+
def add_mcp_tool(
|
|
934
|
+
self, mcp_server_name: str, mcp_tool_name: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
935
|
+
) -> Tool:
|
|
936
|
+
"""
|
|
937
|
+
Add a new MCP tool by server + tool name
|
|
938
|
+
|
|
939
|
+
Parameters
|
|
940
|
+
----------
|
|
941
|
+
mcp_server_name : str
|
|
942
|
+
|
|
943
|
+
mcp_tool_name : str
|
|
944
|
+
|
|
945
|
+
request_options : typing.Optional[RequestOptions]
|
|
946
|
+
Request-specific configuration.
|
|
947
|
+
|
|
948
|
+
Returns
|
|
949
|
+
-------
|
|
950
|
+
Tool
|
|
951
|
+
Successful Response
|
|
952
|
+
|
|
953
|
+
Examples
|
|
954
|
+
--------
|
|
955
|
+
from letta_client import Letta
|
|
956
|
+
|
|
957
|
+
client = Letta(
|
|
958
|
+
token="YOUR_TOKEN",
|
|
959
|
+
)
|
|
960
|
+
client.tools.add_mcp_tool(
|
|
961
|
+
mcp_server_name="mcp_server_name",
|
|
962
|
+
mcp_tool_name="mcp_tool_name",
|
|
963
|
+
)
|
|
964
|
+
"""
|
|
965
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
966
|
+
f"v1/tools/mcp/servers/{jsonable_encoder(mcp_server_name)}/{jsonable_encoder(mcp_tool_name)}",
|
|
967
|
+
method="POST",
|
|
968
|
+
request_options=request_options,
|
|
969
|
+
)
|
|
970
|
+
try:
|
|
971
|
+
if 200 <= _response.status_code < 300:
|
|
972
|
+
return typing.cast(
|
|
973
|
+
Tool,
|
|
974
|
+
construct_type(
|
|
975
|
+
type_=Tool, # type: ignore
|
|
976
|
+
object_=_response.json(),
|
|
977
|
+
),
|
|
978
|
+
)
|
|
979
|
+
if _response.status_code == 422:
|
|
980
|
+
raise UnprocessableEntityError(
|
|
981
|
+
typing.cast(
|
|
982
|
+
HttpValidationError,
|
|
983
|
+
construct_type(
|
|
984
|
+
type_=HttpValidationError, # type: ignore
|
|
985
|
+
object_=_response.json(),
|
|
986
|
+
),
|
|
987
|
+
)
|
|
988
|
+
)
|
|
989
|
+
_response_json = _response.json()
|
|
990
|
+
except JSONDecodeError:
|
|
991
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
992
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
993
|
+
|
|
819
994
|
|
|
820
995
|
class AsyncToolsClient:
|
|
821
996
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -1703,3 +1878,200 @@ class AsyncToolsClient:
|
|
|
1703
1878
|
except JSONDecodeError:
|
|
1704
1879
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1705
1880
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1881
|
+
|
|
1882
|
+
async def list_mcp_servers(
|
|
1883
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
1884
|
+
) -> typing.Dict[str, ListMcpServersResponseValue]:
|
|
1885
|
+
"""
|
|
1886
|
+
Get a list of all configured MCP servers
|
|
1887
|
+
|
|
1888
|
+
Parameters
|
|
1889
|
+
----------
|
|
1890
|
+
request_options : typing.Optional[RequestOptions]
|
|
1891
|
+
Request-specific configuration.
|
|
1892
|
+
|
|
1893
|
+
Returns
|
|
1894
|
+
-------
|
|
1895
|
+
typing.Dict[str, ListMcpServersResponseValue]
|
|
1896
|
+
Successful Response
|
|
1897
|
+
|
|
1898
|
+
Examples
|
|
1899
|
+
--------
|
|
1900
|
+
import asyncio
|
|
1901
|
+
|
|
1902
|
+
from letta_client import AsyncLetta
|
|
1903
|
+
|
|
1904
|
+
client = AsyncLetta(
|
|
1905
|
+
token="YOUR_TOKEN",
|
|
1906
|
+
)
|
|
1907
|
+
|
|
1908
|
+
|
|
1909
|
+
async def main() -> None:
|
|
1910
|
+
await client.tools.list_mcp_servers()
|
|
1911
|
+
|
|
1912
|
+
|
|
1913
|
+
asyncio.run(main())
|
|
1914
|
+
"""
|
|
1915
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1916
|
+
"v1/tools/mcp/servers",
|
|
1917
|
+
method="GET",
|
|
1918
|
+
request_options=request_options,
|
|
1919
|
+
)
|
|
1920
|
+
try:
|
|
1921
|
+
if 200 <= _response.status_code < 300:
|
|
1922
|
+
return typing.cast(
|
|
1923
|
+
typing.Dict[str, ListMcpServersResponseValue],
|
|
1924
|
+
construct_type(
|
|
1925
|
+
type_=typing.Dict[str, ListMcpServersResponseValue], # type: ignore
|
|
1926
|
+
object_=_response.json(),
|
|
1927
|
+
),
|
|
1928
|
+
)
|
|
1929
|
+
if _response.status_code == 422:
|
|
1930
|
+
raise UnprocessableEntityError(
|
|
1931
|
+
typing.cast(
|
|
1932
|
+
HttpValidationError,
|
|
1933
|
+
construct_type(
|
|
1934
|
+
type_=HttpValidationError, # type: ignore
|
|
1935
|
+
object_=_response.json(),
|
|
1936
|
+
),
|
|
1937
|
+
)
|
|
1938
|
+
)
|
|
1939
|
+
_response_json = _response.json()
|
|
1940
|
+
except JSONDecodeError:
|
|
1941
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1942
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1943
|
+
|
|
1944
|
+
async def list_mcp_tools_by_server(
|
|
1945
|
+
self, mcp_server_name: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1946
|
+
) -> typing.List[McpTool]:
|
|
1947
|
+
"""
|
|
1948
|
+
Get a list of all tools for a specific MCP server
|
|
1949
|
+
|
|
1950
|
+
Parameters
|
|
1951
|
+
----------
|
|
1952
|
+
mcp_server_name : str
|
|
1953
|
+
|
|
1954
|
+
request_options : typing.Optional[RequestOptions]
|
|
1955
|
+
Request-specific configuration.
|
|
1956
|
+
|
|
1957
|
+
Returns
|
|
1958
|
+
-------
|
|
1959
|
+
typing.List[McpTool]
|
|
1960
|
+
Successful Response
|
|
1961
|
+
|
|
1962
|
+
Examples
|
|
1963
|
+
--------
|
|
1964
|
+
import asyncio
|
|
1965
|
+
|
|
1966
|
+
from letta_client import AsyncLetta
|
|
1967
|
+
|
|
1968
|
+
client = AsyncLetta(
|
|
1969
|
+
token="YOUR_TOKEN",
|
|
1970
|
+
)
|
|
1971
|
+
|
|
1972
|
+
|
|
1973
|
+
async def main() -> None:
|
|
1974
|
+
await client.tools.list_mcp_tools_by_server(
|
|
1975
|
+
mcp_server_name="mcp_server_name",
|
|
1976
|
+
)
|
|
1977
|
+
|
|
1978
|
+
|
|
1979
|
+
asyncio.run(main())
|
|
1980
|
+
"""
|
|
1981
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1982
|
+
f"v1/tools/mcp/servers/{jsonable_encoder(mcp_server_name)}/tools",
|
|
1983
|
+
method="GET",
|
|
1984
|
+
request_options=request_options,
|
|
1985
|
+
)
|
|
1986
|
+
try:
|
|
1987
|
+
if 200 <= _response.status_code < 300:
|
|
1988
|
+
return typing.cast(
|
|
1989
|
+
typing.List[McpTool],
|
|
1990
|
+
construct_type(
|
|
1991
|
+
type_=typing.List[McpTool], # type: ignore
|
|
1992
|
+
object_=_response.json(),
|
|
1993
|
+
),
|
|
1994
|
+
)
|
|
1995
|
+
if _response.status_code == 422:
|
|
1996
|
+
raise UnprocessableEntityError(
|
|
1997
|
+
typing.cast(
|
|
1998
|
+
HttpValidationError,
|
|
1999
|
+
construct_type(
|
|
2000
|
+
type_=HttpValidationError, # type: ignore
|
|
2001
|
+
object_=_response.json(),
|
|
2002
|
+
),
|
|
2003
|
+
)
|
|
2004
|
+
)
|
|
2005
|
+
_response_json = _response.json()
|
|
2006
|
+
except JSONDecodeError:
|
|
2007
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2008
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2009
|
+
|
|
2010
|
+
async def add_mcp_tool(
|
|
2011
|
+
self, mcp_server_name: str, mcp_tool_name: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
2012
|
+
) -> Tool:
|
|
2013
|
+
"""
|
|
2014
|
+
Add a new MCP tool by server + tool name
|
|
2015
|
+
|
|
2016
|
+
Parameters
|
|
2017
|
+
----------
|
|
2018
|
+
mcp_server_name : str
|
|
2019
|
+
|
|
2020
|
+
mcp_tool_name : str
|
|
2021
|
+
|
|
2022
|
+
request_options : typing.Optional[RequestOptions]
|
|
2023
|
+
Request-specific configuration.
|
|
2024
|
+
|
|
2025
|
+
Returns
|
|
2026
|
+
-------
|
|
2027
|
+
Tool
|
|
2028
|
+
Successful Response
|
|
2029
|
+
|
|
2030
|
+
Examples
|
|
2031
|
+
--------
|
|
2032
|
+
import asyncio
|
|
2033
|
+
|
|
2034
|
+
from letta_client import AsyncLetta
|
|
2035
|
+
|
|
2036
|
+
client = AsyncLetta(
|
|
2037
|
+
token="YOUR_TOKEN",
|
|
2038
|
+
)
|
|
2039
|
+
|
|
2040
|
+
|
|
2041
|
+
async def main() -> None:
|
|
2042
|
+
await client.tools.add_mcp_tool(
|
|
2043
|
+
mcp_server_name="mcp_server_name",
|
|
2044
|
+
mcp_tool_name="mcp_tool_name",
|
|
2045
|
+
)
|
|
2046
|
+
|
|
2047
|
+
|
|
2048
|
+
asyncio.run(main())
|
|
2049
|
+
"""
|
|
2050
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2051
|
+
f"v1/tools/mcp/servers/{jsonable_encoder(mcp_server_name)}/{jsonable_encoder(mcp_tool_name)}",
|
|
2052
|
+
method="POST",
|
|
2053
|
+
request_options=request_options,
|
|
2054
|
+
)
|
|
2055
|
+
try:
|
|
2056
|
+
if 200 <= _response.status_code < 300:
|
|
2057
|
+
return typing.cast(
|
|
2058
|
+
Tool,
|
|
2059
|
+
construct_type(
|
|
2060
|
+
type_=Tool, # type: ignore
|
|
2061
|
+
object_=_response.json(),
|
|
2062
|
+
),
|
|
2063
|
+
)
|
|
2064
|
+
if _response.status_code == 422:
|
|
2065
|
+
raise UnprocessableEntityError(
|
|
2066
|
+
typing.cast(
|
|
2067
|
+
HttpValidationError,
|
|
2068
|
+
construct_type(
|
|
2069
|
+
type_=HttpValidationError, # type: ignore
|
|
2070
|
+
object_=_response.json(),
|
|
2071
|
+
),
|
|
2072
|
+
)
|
|
2073
|
+
)
|
|
2074
|
+
_response_json = _response.json()
|
|
2075
|
+
except JSONDecodeError:
|
|
2076
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2077
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ...types.sse_server_config import SseServerConfig
|
|
5
|
+
from ...types.local_server_config import LocalServerConfig
|
|
6
|
+
|
|
7
|
+
ListMcpServersResponseValue = typing.Union[SseServerConfig, LocalServerConfig]
|
letta_client/types/__init__.py
CHANGED
|
@@ -72,6 +72,7 @@ from .conflict_error_body import ConflictErrorBody
|
|
|
72
72
|
from .context_window_overview import ContextWindowOverview
|
|
73
73
|
from .continue_tool_rule import ContinueToolRule
|
|
74
74
|
from .create_block import CreateBlock
|
|
75
|
+
from .dynamic_manager import DynamicManager
|
|
75
76
|
from .e_2_b_sandbox_config import E2BSandboxConfig
|
|
76
77
|
from .embedding_config import EmbeddingConfig
|
|
77
78
|
from .embedding_config_embedding_endpoint_type import EmbeddingConfigEmbeddingEndpointType
|
|
@@ -83,6 +84,9 @@ from .function_definition_input import FunctionDefinitionInput
|
|
|
83
84
|
from .function_definition_output import FunctionDefinitionOutput
|
|
84
85
|
from .function_output import FunctionOutput
|
|
85
86
|
from .function_tool import FunctionTool
|
|
87
|
+
from .group import Group
|
|
88
|
+
from .group_create import GroupCreate
|
|
89
|
+
from .group_create_manager_config import GroupCreateManagerConfig
|
|
86
90
|
from .health import Health
|
|
87
91
|
from .http_validation_error import HttpValidationError
|
|
88
92
|
from .identity import Identity
|
|
@@ -105,10 +109,15 @@ from .letta_message_union import LettaMessageUnion
|
|
|
105
109
|
from .letta_request import LettaRequest
|
|
106
110
|
from .letta_request_config import LettaRequestConfig
|
|
107
111
|
from .letta_response import LettaResponse
|
|
112
|
+
from .letta_streaming_request import LettaStreamingRequest
|
|
108
113
|
from .letta_usage_statistics import LettaUsageStatistics
|
|
109
114
|
from .llm_config import LlmConfig
|
|
110
115
|
from .llm_config_model_endpoint_type import LlmConfigModelEndpointType
|
|
111
116
|
from .local_sandbox_config import LocalSandboxConfig
|
|
117
|
+
from .local_server_config import LocalServerConfig
|
|
118
|
+
from .manager_type import ManagerType
|
|
119
|
+
from .mcp_server_type import McpServerType
|
|
120
|
+
from .mcp_tool import McpTool
|
|
112
121
|
from .memory import Memory
|
|
113
122
|
from .message import Message
|
|
114
123
|
from .message_create import MessageCreate
|
|
@@ -133,6 +142,7 @@ from .reasoning_message import ReasoningMessage
|
|
|
133
142
|
from .response_format_json_object import ResponseFormatJsonObject
|
|
134
143
|
from .response_format_json_schema import ResponseFormatJsonSchema
|
|
135
144
|
from .response_format_text import ResponseFormatText
|
|
145
|
+
from .round_robin_manager import RoundRobinManager
|
|
136
146
|
from .run import Run
|
|
137
147
|
from .sandbox_config import SandboxConfig
|
|
138
148
|
from .sandbox_config_create import SandboxConfigCreate
|
|
@@ -144,7 +154,9 @@ from .sandbox_environment_variable_create import SandboxEnvironmentVariableCreat
|
|
|
144
154
|
from .sandbox_environment_variable_update import SandboxEnvironmentVariableUpdate
|
|
145
155
|
from .sandbox_type import SandboxType
|
|
146
156
|
from .source import Source
|
|
157
|
+
from .sse_server_config import SseServerConfig
|
|
147
158
|
from .step import Step
|
|
159
|
+
from .supervisor_manager import SupervisorManager
|
|
148
160
|
from .system_message import SystemMessage
|
|
149
161
|
from .system_message_content import SystemMessageContent
|
|
150
162
|
from .terminal_tool_rule import TerminalToolRule
|
|
@@ -254,6 +266,7 @@ __all__ = [
|
|
|
254
266
|
"ContextWindowOverview",
|
|
255
267
|
"ContinueToolRule",
|
|
256
268
|
"CreateBlock",
|
|
269
|
+
"DynamicManager",
|
|
257
270
|
"E2BSandboxConfig",
|
|
258
271
|
"EmbeddingConfig",
|
|
259
272
|
"EmbeddingConfigEmbeddingEndpointType",
|
|
@@ -265,6 +278,9 @@ __all__ = [
|
|
|
265
278
|
"FunctionDefinitionOutput",
|
|
266
279
|
"FunctionOutput",
|
|
267
280
|
"FunctionTool",
|
|
281
|
+
"Group",
|
|
282
|
+
"GroupCreate",
|
|
283
|
+
"GroupCreateManagerConfig",
|
|
268
284
|
"Health",
|
|
269
285
|
"HttpValidationError",
|
|
270
286
|
"Identity",
|
|
@@ -287,10 +303,15 @@ __all__ = [
|
|
|
287
303
|
"LettaRequest",
|
|
288
304
|
"LettaRequestConfig",
|
|
289
305
|
"LettaResponse",
|
|
306
|
+
"LettaStreamingRequest",
|
|
290
307
|
"LettaUsageStatistics",
|
|
291
308
|
"LlmConfig",
|
|
292
309
|
"LlmConfigModelEndpointType",
|
|
293
310
|
"LocalSandboxConfig",
|
|
311
|
+
"LocalServerConfig",
|
|
312
|
+
"ManagerType",
|
|
313
|
+
"McpServerType",
|
|
314
|
+
"McpTool",
|
|
294
315
|
"Memory",
|
|
295
316
|
"Message",
|
|
296
317
|
"MessageCreate",
|
|
@@ -311,6 +332,7 @@ __all__ = [
|
|
|
311
332
|
"ResponseFormatJsonObject",
|
|
312
333
|
"ResponseFormatJsonSchema",
|
|
313
334
|
"ResponseFormatText",
|
|
335
|
+
"RoundRobinManager",
|
|
314
336
|
"Run",
|
|
315
337
|
"SandboxConfig",
|
|
316
338
|
"SandboxConfigCreate",
|
|
@@ -322,7 +344,9 @@ __all__ = [
|
|
|
322
344
|
"SandboxEnvironmentVariableUpdate",
|
|
323
345
|
"SandboxType",
|
|
324
346
|
"Source",
|
|
347
|
+
"SseServerConfig",
|
|
325
348
|
"Step",
|
|
349
|
+
"SupervisorManager",
|
|
326
350
|
"SystemMessage",
|
|
327
351
|
"SystemMessageContent",
|
|
328
352
|
"TerminalToolRule",
|
|
@@ -12,6 +12,7 @@ from .memory import Memory
|
|
|
12
12
|
from .tool import Tool
|
|
13
13
|
from .source import Source
|
|
14
14
|
from .agent_environment_variable import AgentEnvironmentVariable
|
|
15
|
+
from .group import Group
|
|
15
16
|
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
16
17
|
|
|
17
18
|
|
|
@@ -153,6 +154,11 @@ class AgentState(UncheckedBaseModel):
|
|
|
153
154
|
If set to True, the agent will not remember previous messages (though the agent will still retain state via core memory blocks and archival/recall memory). Not recommended unless you have an advanced use case.
|
|
154
155
|
"""
|
|
155
156
|
|
|
157
|
+
multi_agent_group: typing.Optional[Group] = pydantic.Field(default=None)
|
|
158
|
+
"""
|
|
159
|
+
The multi-agent group that this agent manages
|
|
160
|
+
"""
|
|
161
|
+
|
|
156
162
|
if IS_PYDANTIC_V2:
|
|
157
163
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
158
164
|
else:
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class DynamicManager(UncheckedBaseModel):
|
|
10
|
+
manager_type: typing.Literal["dynamic"] = "dynamic"
|
|
11
|
+
manager_agent_id: str = pydantic.Field()
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
termination_token: typing.Optional[str] = pydantic.Field(default=None)
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
max_turns: typing.Optional[int] = pydantic.Field(default=None)
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
if IS_PYDANTIC_V2:
|
|
27
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
28
|
+
else:
|
|
29
|
+
|
|
30
|
+
class Config:
|
|
31
|
+
frozen = True
|
|
32
|
+
smart_union = True
|
|
33
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
import pydantic
|
|
5
|
+
from .manager_type import ManagerType
|
|
6
|
+
import typing
|
|
7
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Group(UncheckedBaseModel):
|
|
11
|
+
id: str = pydantic.Field()
|
|
12
|
+
"""
|
|
13
|
+
The id of the group. Assigned by the database.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
manager_type: ManagerType = pydantic.Field()
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
agent_ids: typing.List[str] = pydantic.Field()
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
description: str = pydantic.Field()
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
manager_agent_id: typing.Optional[str] = pydantic.Field(default=None)
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
termination_token: typing.Optional[str] = pydantic.Field(default=None)
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
max_turns: typing.Optional[int] = pydantic.Field(default=None)
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
if IS_PYDANTIC_V2:
|
|
47
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
48
|
+
else:
|
|
49
|
+
|
|
50
|
+
class Config:
|
|
51
|
+
frozen = True
|
|
52
|
+
smart_union = True
|
|
53
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
import pydantic
|
|
6
|
+
from .group_create_manager_config import GroupCreateManagerConfig
|
|
7
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class GroupCreate(UncheckedBaseModel):
|
|
11
|
+
agent_ids: typing.List[str] = pydantic.Field()
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
description: str = pydantic.Field()
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
manager_config: typing.Optional[GroupCreateManagerConfig] = pydantic.Field(default=None)
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
if IS_PYDANTIC_V2:
|
|
27
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
28
|
+
else:
|
|
29
|
+
|
|
30
|
+
class Config:
|
|
31
|
+
frozen = True
|
|
32
|
+
smart_union = True
|
|
33
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from .dynamic_manager import DynamicManager
|
|
5
|
+
from .round_robin_manager import RoundRobinManager
|
|
6
|
+
from .supervisor_manager import SupervisorManager
|
|
7
|
+
|
|
8
|
+
GroupCreateManagerConfig = typing.Union[DynamicManager, RoundRobinManager, SupervisorManager]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
from .message_create import MessageCreate
|
|
6
|
+
import pydantic
|
|
7
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class LettaStreamingRequest(UncheckedBaseModel):
|
|
11
|
+
messages: typing.List[MessageCreate] = pydantic.Field()
|
|
12
|
+
"""
|
|
13
|
+
The messages to be sent to the agent.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
use_assistant_message: typing.Optional[bool] = pydantic.Field(default=None)
|
|
17
|
+
"""
|
|
18
|
+
Whether the server should parse specific tool call arguments (default `send_message`) as `AssistantMessage` objects.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
assistant_message_tool_name: typing.Optional[str] = pydantic.Field(default=None)
|
|
22
|
+
"""
|
|
23
|
+
The name of the designated message tool.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
assistant_message_tool_kwarg: typing.Optional[str] = pydantic.Field(default=None)
|
|
27
|
+
"""
|
|
28
|
+
The name of the message argument in the designated message tool.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
stream_tokens: typing.Optional[bool] = pydantic.Field(default=None)
|
|
32
|
+
"""
|
|
33
|
+
Flag to determine if individual tokens should be streamed. Set to True for token streaming (requires stream_steps = True).
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
if IS_PYDANTIC_V2:
|
|
37
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
38
|
+
else:
|
|
39
|
+
|
|
40
|
+
class Config:
|
|
41
|
+
frozen = True
|
|
42
|
+
smart_union = True
|
|
43
|
+
extra = pydantic.Extra.allow
|