{"id":97143,"date":"2026-08-29T03:56:35","date_gmt":"2026-08-28T19:56:35","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/97143.html"},"modified":"2026-08-29T03:56:35","modified_gmt":"2026-08-28T19:56:35","slug":"agent-%e6%96%87%e4%bb%b6%e4%bc%a0%e9%80%92","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/97143.html","title":{"rendered":"Agent \u6587\u4ef6\u4f20\u9012"},"content":{"rendered":"<\/p>\n<h3>1. \u95ee\u9898<\/h3>\n<p>\u76ee\u524d Agent \u5df2\u7ecf\u53ef\u4ee5\u5728\u5de5\u4f5c\u76ee\u5f55\u4e2d\u521b\u5efa\u548c\u5904\u7406\u6587\u4ef6&#xff0c;\u4f46\u8fd9\u4e9b\u6587\u4ef6\u90fd\u4fdd\u5b58\u5728\u540e\u7aef\u670d\u52a1\u5668\u4e0a&#xff0c;\u524d\u7aef\u65e0\u6cd5\u76f4\u63a5\u8bbf\u95ee\u3002<\/p>\n<p>\u56e0\u6b64\u9700\u8981\u589e\u52a0\u4e00\u4e2a\u4e2d\u95f4\u73af\u8282&#xff0c;\u628a Agent \u751f\u6210\u7684\u6587\u4ef6\u4ea4\u7ed9\u7528\u6237\u3002<\/p>\n<p>\u8fd9\u91cc\u91c7\u7528\u5bf9\u8c61\u5b58\u50a8\u7684\u65b9\u5f0f&#xff1a;<\/p>\n<p>Agent\u751f\u6210\u6587\u4ef6<br \/>\n    \u2193<br \/>\n\u5de5\u4f5c\u76ee\u5f55<br \/>\n    \u2193<br \/>\n\u6253\u5305<br \/>\n    \u2193<br \/>\nMinIO<br \/>\n    \u2193<br \/>\n\u751f\u6210\u4e0b\u8f7d\u94fe\u63a5<br \/>\n    \u2193<br \/>\n\u524d\u7aef\u4e0b\u8f7d<\/p>\n<p>\u8fd9\u6837 Agent \u4ecd\u7136\u53ea\u8d1f\u8d23\u5904\u7406\u81ea\u5df1\u7684\u5de5\u4f5c\u76ee\u5f55&#xff0c;\u6587\u4ef6\u4ea4\u4ed8\u7531\u540e\u7eed\u6d41\u7a0b\u5b8c\u6210\u3002<\/p>\n<hr \/>\n<h3>2. \u5bf9\u8c61\u5b58\u50a8<\/h3>\n<p>**\u5bf9\u8c61\u5b58\u50a8&#xff08;Object Storage&#xff09;**\u4e3b\u8981\u7528\u4e8e\u4fdd\u5b58\u56fe\u7247\u3001\u89c6\u9891\u3001\u538b\u7f29\u5305\u7b49\u975e\u7ed3\u6784\u5316\u6587\u4ef6\u3002<\/p>\n<p>\u548c\u666e\u901a\u6587\u4ef6\u7cfb\u7edf\u76f8\u6bd4&#xff0c;\u5bf9\u8c61\u5b58\u50a8\u66f4\u9002\u5408\u901a\u8fc7\u7a0b\u5e8f\u8fdb\u884c\u6587\u4ef6\u4e0a\u4f20\u548c\u8bbf\u95ee\u3002\u53ef\u4ee5\u7b80\u5355\u7406\u89e3\u6210\u4e00\u4e2a\u53ef\u4ee5\u901a\u8fc7 API \u64cd\u4f5c\u7684\u7f51\u76d8\u3002<\/p>\n<p>\u672c\u9879\u76ee\u4f7f\u7528 MinIO\u3002<\/p>\n<p>MinIO \u662f\u4e00\u4e2a\u5f00\u6e90\u5bf9\u8c61\u5b58\u50a8\u670d\u52a1&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u90e8\u7f72\u5728\u81ea\u5df1\u7684\u670d\u52a1\u5668\u4e0a&#xff0c;\u5e76\u63d0\u4f9b Python SDK\u3002<\/p>\n<p>\u8fd9\u91cc\u4f7f\u7528 MinIO \u4e3b\u8981\u662f\u56e0\u4e3a\u9879\u76ee\u672c\u8eab\u53ef\u4ee5\u672c\u5730\u90e8\u7f72&#xff0c;\u6ca1\u6709\u5fc5\u8981\u4e3a\u4e86\u6587\u4ef6\u5b58\u50a8\u518d\u4f9d\u8d56\u7b2c\u4e09\u65b9\u4e91\u5b58\u50a8\u3002<\/p>\n<hr \/>\n<h3>3. MinIO \u90e8\u7f72<\/h3>\n<p>\u9879\u76ee\u4f7f\u7528 Docker \u90e8\u7f72 MinIO\u3002<\/p>\n<p>docker pull minio\/minio<\/p>\n<p>mkdir -p \/usr\/local\/minio-data<\/p>\n<p>docker run -p 9000:9000 -p 9190:9090 \\\\<br \/>\n&#8211;name minio \\\\<br \/>\n-d &#8211;restart&#061;always \\\\<br \/>\n-e &#034;MINIO_ROOT_USER&#061;minio&#034; \\\\<br \/>\n-e &#034;MINIO_ROOT_PASSWORD&#061;minio123&#034; \\\\<br \/>\n-v \/usr\/local\/minio-data:\/data \\\\<br \/>\nminio\/minio server \/data &#8211;console-address &#034;:9090&#034;<\/p>\n<p>\u542f\u52a8\u540e\u53ef\u4ee5\u901a\u8fc7&#xff1a;<\/p>\n<p>http:\/\/\u670d\u52a1\u5668IP:9190<\/p>\n<p>\u8fdb\u5165 MinIO \u7ba1\u7406\u9875\u9762\u3002<\/p>\n<p>\u5982\u679c\u662f\u5728\u672c\u673a\u90e8\u7f72&#xff0c;\u5219\u4f7f\u7528&#xff1a;<\/p>\n<p>http:\/\/localhost:9190<\/p>\n<p>\u767b\u5f55\u540e\u5373\u53ef\u770b\u5230 MinIO \u7684\u7ba1\u7406\u754c\u9762\u3002<\/p>\n<hr \/>\n<h3>4. Python SDK<\/h3>\n<p>\u5b89\u88c5 MinIO \u7684 Python SDK&#xff1a;<\/p>\n<p>pip install minio<\/p>\n<p>\u6700\u57fa\u672c\u7684\u64cd\u4f5c\u5c31\u662f\u8fde\u63a5 MinIO\u3001\u521b\u5efa Bucket\u3001\u4e0a\u4f20\u6587\u4ef6\u4ee5\u53ca\u751f\u6210\u4e0b\u8f7d\u94fe\u63a5\u3002<\/p>\n<p>from minio import Minio<\/p>\n<p>client &#061; Minio(<br \/>\n    &#034;localhost:9000&#034;,<br \/>\n    access_key&#061;&#034;minio&#034;,<br \/>\n    secret_key&#061;&#034;minio123&#034;,<br \/>\n    secure&#061;False<br \/>\n)<\/p>\n<p>\u9879\u76ee\u5b9e\u9645\u53ea\u9700\u8981\u7528\u5230\u5176\u4e2d\u4e24\u4e2a\u64cd\u4f5c&#xff1a;<\/p>\n<p>\u4e0a\u4f20\u6587\u4ef6<br \/>\n\u751f\u6210\u4e0b\u8f7d\u94fe\u63a5<\/p>\n<p>\u4e0b\u8f7d\u94fe\u63a5\u4f7f\u7528 presigned_get_object() \u751f\u6210\u3002<\/p>\n<p>\u5b83\u8fd4\u56de\u7684\u662f\u4e00\u4e2a\u5e26\u6709\u6548\u671f\u7684 URL&#xff0c;\u7528\u6237\u62ff\u5230\u94fe\u63a5\u540e\u53ef\u4ee5\u76f4\u63a5\u4e0b\u8f7d\u6587\u4ef6&#xff0c;\u4e0d\u9700\u8981\u77e5\u9053 MinIO \u7684\u8d26\u53f7\u5bc6\u7801\u3002<\/p>\n<hr \/>\n<h3>5. \u6587\u4ef6\u4f20\u9012\u65b9\u6848<\/h3>\n<h4>5.1 \u4e3a\u4ec0\u4e48\u9700\u8981\u6253\u5305<\/h4>\n<p>\u4e00\u4e2a Agent \u4efb\u52a1\u4e0d\u4e00\u5b9a\u53ea\u751f\u6210\u4e00\u4e2a\u6587\u4ef6\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>\u5de5\u4f5c\u76ee\u5f55\/<br \/>\n\u251c\u2500\u2500 result.docx<br \/>\n\u251c\u2500\u2500 data.xlsx<br \/>\n\u251c\u2500\u2500 image.png<br \/>\n\u2514\u2500\u2500 output.pdf<\/p>\n<p>\u5982\u679c\u9010\u4e2a\u4e0a\u4f20\u5e76\u751f\u6210\u94fe\u63a5&#xff0c;\u524d\u7aef\u8fd8\u9700\u8981\u5904\u7406\u591a\u4e2a\u6587\u4ef6\u3002<\/p>\n<p>\u56e0\u6b64\u8fd9\u91cc\u76f4\u63a5\u5c06\u6574\u4e2a\u5de5\u4f5c\u76ee\u5f55\u6253\u5305\u6210\u4e00\u4e2a ZIP&#xff1a;<\/p>\n<p>\u5de5\u4f5c\u76ee\u5f55<br \/>\n   \u2193<br \/>\noutput.zip<br \/>\n   \u2193<br \/>\nMinIO<br \/>\n   \u2193<br \/>\n\u4e00\u4e2a\u4e0b\u8f7d\u94fe\u63a5<\/p>\n<p>\u7528\u6237\u53ea\u9700\u8981\u4e0b\u8f7d\u4e00\u4e2a\u6587\u4ef6\u5373\u53ef\u3002<\/p>\n<h4>5.2 \u4e3a\u4ec0\u4e48\u653e\u5230 Agent \u7ed3\u675f\u4e4b\u540e\u5904\u7406<\/h4>\n<p>\u6587\u4ef6\u4e0a\u4f20\u4e0d\u5c5e\u4e8e\u5177\u4f53\u5de5\u5177\u7684\u529f\u80fd\u3002<\/p>\n<p>\u4f8b\u5982 create_file \u5de5\u5177\u53ea\u8d1f\u8d23\u521b\u5efa\u6587\u4ef6&#xff0c;\u5982\u679c\u8ba9\u5b83\u540c\u65f6\u8d1f\u8d23\u4e0a\u4f20&#xff0c;\u5c31\u4f1a\u8ba9\u5de5\u5177\u672c\u8eab\u627f\u62c5\u6587\u4ef6\u4ea4\u4ed8\u7684\u5de5\u4f5c\u3002<\/p>\n<p>\u56e0\u6b64\u5c06\u8fd9\u90e8\u5206\u653e\u5230 FileMiddleware \u4e2d&#xff0c;\u5728 Agent \u6267\u884c\u5b8c\u6210\u540e\u7edf\u4e00\u5904\u7406\u3002<\/p>\n<hr \/>\n<h3>6. \u5f00\u59cb\u5b9e\u73b0<\/h3>\n<h4>6.1 \u6dfb\u52a0 ZIP \u538b\u7f29\u65b9\u6cd5<\/h4>\n<p>\u5728 utils\/doc_utils \u4e0b\u589e\u52a0 zip_files.py\u3002<\/p>\n<p>\u4f7f\u7528 Python \u81ea\u5e26\u7684 shutil \u76f4\u63a5\u538b\u7f29\u76ee\u5f55&#xff1a;<\/p>\n<p>import os<br \/>\nimport shutil<\/p>\n<p>def compress_dir(folder_path):<br \/>\n    &#034;&#034;&#034;<br \/>\n    \u5c06\u76ee\u5f55\u538b\u7f29\u6210 zip<br \/>\n    &#034;&#034;&#034;<br \/>\n    output_path &#061; shutil.make_archive(<br \/>\n        base_name&#061;folder_path,<br \/>\n        format&#061;&#034;zip&#034;,<br \/>\n        root_dir&#061;os.path.dirname(folder_path),<br \/>\n        base_dir&#061;os.path.basename(folder_path)<br \/>\n    )<\/p>\n<p>    return output_path<\/p>\n<p>\u8fd9\u91cc\u6ca1\u6709\u989d\u5916\u5f15\u5165\u538b\u7f29\u5e93&#xff0c;\u9879\u76ee\u76ee\u524d\u7684\u9700\u6c42\u6bd4\u8f83\u7b80\u5355&#xff0c;\u6807\u51c6\u5e93\u5c31\u591f\u7528\u4e86\u3002<\/p>\n<hr \/>\n<h4>6.2 \u6dfb\u52a0 MinIO \u914d\u7f6e<\/h4>\n<p>MinIO \u7684\u5730\u5740\u548c\u8ba4\u8bc1\u4fe1\u606f\u653e\u5230 .env \u4e2d&#xff1a;<\/p>\n<p>HOST_IP&#061;localhost<br \/>\nMINIO_PORT&#061;9000<br \/>\nMINIO_ACCESS_KEY&#061;minio<br \/>\nMINIO_SECRET_KEY&#061;minio123<\/p>\n<p>\u7136\u540e\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u7edf\u4e00\u8bfb\u53d6&#xff1a;<\/p>\n<p>HOST_IP &#061; os.getenv(&#034;HOST_IP&#034;)<br \/>\nMINIO_PORT &#061; os.getenv(&#034;MINIO_PORT&#034;)<\/p>\n<p>MINIO_ENDPOINT &#061; f&#034;{HOST_IP}:{MINIO_PORT}&#034;<\/p>\n<p>MINIO_ACCESS_KEY &#061; os.getenv(&#034;MINIO_ACCESS_KEY&#034;)<br \/>\nMINIO_SECRET_KEY &#061; os.getenv(&#034;MINIO_SECRET_KEY&#034;)<\/p>\n<p>\u8fd9\u6837\u4ee3\u7801\u4e2d\u4e0d\u9700\u8981\u76f4\u63a5\u5199 MinIO \u7684\u8fde\u63a5\u4fe1\u606f&#xff0c;\u90e8\u7f72\u5230\u5176\u4ed6\u73af\u5883\u65f6\u53ea\u9700\u8981\u4fee\u6539\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<hr \/>\n<h4>6.3 \u5c01\u88c5 MinIO \u8fde\u63a5<\/h4>\n<p>\u5728 conn \u4e0b\u65b0\u5efa minio_conn.py\u3002<\/p>\n<p>\u4e0d\u76f4\u63a5\u5728 Middleware \u4e2d\u64cd\u4f5c MinIO SDK&#xff0c;\u800c\u662f\u7b80\u5355\u5c01\u88c5\u4e00\u5c42&#xff1a;<\/p>\n<p>from minio import Minio<br \/>\nfrom base import configs as cfg<\/p>\n<p>class MinioConn:<\/p>\n<p>    def __init__(self):<br \/>\n        self.client &#061; self.create_client()<br \/>\n        self.bucket_name &#061; &#034;stores&#034;<br \/>\n        self._init_bucket()<\/p>\n<p>    def create_client(self):<br \/>\n        return Minio(<br \/>\n            cfg.MINIO_ENDPOINT,<br \/>\n            access_key&#061;cfg.MINIO_ACCESS_KEY,<br \/>\n            secret_key&#061;cfg.MINIO_SECRET_KEY,<br \/>\n            secure&#061;False<br \/>\n        )<\/p>\n<p>    def _init_bucket(self):<br \/>\n        if not self.client.bucket_exists(self.bucket_name):<br \/>\n            self.client.make_bucket(self.bucket_name)<\/p>\n<p>    def upload_obj(self, object_name, file_path):<br \/>\n        self.client.fput_object(<br \/>\n            self.bucket_name,<br \/>\n            object_name,<br \/>\n            file_path<br \/>\n        )<\/p>\n<p>    def gen_presigned_url(self, object_name):<br \/>\n        return self.client.presigned_get_object(<br \/>\n            self.bucket_name,<br \/>\n            object_name<br \/>\n        )<\/p>\n<p>\u8fd9\u91cc\u6682\u65f6\u53ea\u4fdd\u7559\u9879\u76ee\u9700\u8981\u7684\u4e24\u4e2a\u65b9\u6cd5&#xff1a;<\/p>\n<p>upload_obj()<br \/>\ngen_presigned_url()<\/p>\n<p>Bucket \u5728\u521d\u59cb\u5316\u65f6\u68c0\u67e5&#xff0c;\u4e0d\u5b58\u5728\u5c31\u81ea\u52a8\u521b\u5efa\u3002<\/p>\n<hr \/>\n<h3>7. \u63a5\u5165 FileMiddleware<\/h3>\n<p>MinIO \u90e8\u5206\u51c6\u5907\u597d\u4e4b\u540e&#xff0c;\u6700\u540e\u9700\u8981\u628a\u5b83\u63a5\u5230 Agent \u7684\u6267\u884c\u6d41\u7a0b\u4e2d\u3002<\/p>\n<p>\u9996\u5148\u5728 FileMiddleware \u521d\u59cb\u5316\u65f6\u521b\u5efa MinIO \u8fde\u63a5&#xff1a;<\/p>\n<p>class FileMiddleware(AgentMiddleware[CustomState]):<\/p>\n<p>    def __init__(self):<br \/>\n        super().__init__()<br \/>\n        self.mc &#061; MinioConn()<\/p>\n<p>\u7136\u540e\u5229\u7528 before_agent \u548c aafter_agent \u4e24\u4e2a\u751f\u547d\u5468\u671f\u8282\u70b9\u5b8c\u6210\u6587\u4ef6\u5904\u7406\u3002<\/p>\n<h4>7.1 \u8bb0\u5f55\u5f00\u59cb\u65f6\u95f4<\/h4>\n<p>\u5728 before_agent \u4e2d\u8bb0\u5f55\u5f53\u524d\u4efb\u52a1\u7684\u5f00\u59cb\u65f6\u95f4\u3002<\/p>\n<p>\u539f\u56e0\u662f\u5de5\u4f5c\u76ee\u5f55\u53ef\u80fd\u672c\u8eab\u5c31\u5b58\u5728\u4e00\u4e9b\u6587\u4ef6&#xff0c;\u4e0d\u80fd\u6bcf\u6b21 Agent \u6267\u884c\u7ed3\u675f\u90fd\u628a\u6574\u4e2a\u76ee\u5f55\u5f53\u6210\u65b0\u6587\u4ef6\u3002<\/p>\n<p>\u56e0\u6b64\u9700\u8981\u77e5\u9053&#xff1a;<\/p>\n<p>Agent \u5f00\u59cb\u6267\u884c\u4e4b\u540e&#xff0c;\u6709\u6ca1\u6709\u4ea7\u751f\u65b0\u7684\u6587\u4ef6\u3002<\/p>\n<hr \/>\n<h4>7.2 Agent \u6267\u884c\u7ed3\u675f\u540e\u5904\u7406\u6587\u4ef6<\/h4>\n<p>\u4e3b\u8981\u903b\u8f91\u653e\u5728 aafter_agent&#xff1a;<\/p>\n<p>async def aafter_agent(self, state, runtime):<\/p>\n<p>    dir_path &#061; rt.get_root_thread_dir()<\/p>\n<p>    # \u5224\u65ad\u4efb\u52a1\u671f\u95f4\u662f\u5426\u4ea7\u751f\u65b0\u6587\u4ef6<br \/>\n    if not await self._check_if_new_file(<br \/>\n        dir_path,<br \/>\n        state[&#034;start_work_time&#034;]<br \/>\n    ):<br \/>\n        return None<\/p>\n<p>    # \u538b\u7f29\u76ee\u5f55<br \/>\n    local_path &#061; await asyncio.to_thread(<br \/>\n        compress_dir,<br \/>\n        dir_path<br \/>\n    )<\/p>\n<p>    # \u4e0a\u4f20 MinIO<br \/>\n    object_name &#061; os.path.basename(local_path)<\/p>\n<p>    await asyncio.to_thread(<br \/>\n        self.mc.upload_obj,<br \/>\n        object_name,<br \/>\n        local_path<br \/>\n    )<\/p>\n<p>    # \u751f\u6210\u4e0b\u8f7d\u94fe\u63a5<br \/>\n    url &#061; self.mc.gen_presigned_url(object_name)<\/p>\n<p>    return {<br \/>\n        &#034;messages&#034;: [<br \/>\n            AIMessage(content&#061;&#034;\u53ef\u901a\u8fc7\u5982\u4e0b\u5730\u5740\u4e0b\u8f7d&#xff1a;&#034;),<br \/>\n            AIMessage(content&#061;url)<br \/>\n        ]<br \/>\n    }<\/p>\n<p>\u8fd9\u91cc\u538b\u7f29\u548c\u4e0a\u4f20\u90fd\u5c5e\u4e8e\u6bd4\u8f83\u660e\u663e\u7684\u6587\u4ef6 I\/O \u64cd\u4f5c&#xff0c;\u56e0\u6b64\u4f7f\u7528&#xff1a;<\/p>\n<p>asyncio.to_thread()<\/p>\n<p>\u6267\u884c&#xff0c;\u907f\u514d\u76f4\u63a5\u963b\u585e\u5f53\u524d\u5f02\u6b65\u6d41\u7a0b\u3002<\/p>\n<p>\u5982\u679c\u4efb\u52a1\u671f\u95f4\u6ca1\u6709\u4ea7\u751f\u6587\u4ef6&#xff0c;\u5219\u76f4\u63a5\u8fd4\u56de&#xff0c;\u4e0d\u8fdb\u884c\u538b\u7f29\u548c\u4e0a\u4f20\u3002<\/p>\n<hr \/>\n<h3>8. \u6d4b\u8bd5<\/h3>\n<p>\u53ef\u4ee5\u76f4\u63a5\u5728 Agent Chat UI \u4e2d\u6d4b\u8bd5&#xff0c;\u4f8b\u5982&#xff1a;<\/p>\n<p>\u505a\u4e2a a.txt&#xff0c;\u968f\u4fbf\u5199\u70b9\u4ec0\u4e48<\/p>\n<p>Agent \u5b8c\u6210\u540e&#xff0c;\u53ef\u4ee5\u770b\u5230\u8fd4\u56de\u7ed3\u679c\u4e2d\u591a\u4e86\u4e00\u6761\u4e0b\u8f7d\u94fe\u63a5\u3002<\/p>\n<p>\u6574\u4e2a\u8fc7\u7a0b\u5b9e\u9645\u4e0a\u5c31\u662f&#xff1a;<\/p>\n<p>\u521b\u5efa a.txt<br \/>\n    \u2193<br \/>\nAgent \u6267\u884c\u7ed3\u675f<br \/>\n    \u2193<br \/>\n\u68c0\u6d4b\u5230\u65b0\u6587\u4ef6<br \/>\n    \u2193<br \/>\n\u5de5\u4f5c\u76ee\u5f55\u538b\u7f29\u6210 ZIP<br \/>\n    \u2193<br \/>\n\u4e0a\u4f20 MinIO<br \/>\n    \u2193<br \/>\n\u751f\u6210 Presigned URL<br \/>\n    \u2193<br \/>\n\u8fd4\u56de\u7ed9\u524d\u7aef<\/p>\n<p>\u70b9\u51fb\u94fe\u63a5\u5373\u53ef\u4e0b\u8f7d Agent \u751f\u6210\u7684\u6587\u4ef6\u3002<\/p>\n<hr \/>\n<h3>9. \u4fee\u6539\u540e\u7684\u76ee\u5f55<\/h3>\n<p>\u672c\u6b21\u4e3b\u8981\u6d89\u53ca\u4ee5\u4e0b\u51e0\u4e2a\u6587\u4ef6&#xff1a;<\/p>\n<p>.env<br \/>\n    # MinIO \u914d\u7f6e<\/p>\n<p>base\/<br \/>\n\u2514\u2500\u2500 configs.py<br \/>\n    # \u8bfb\u53d6 MinIO \u914d\u7f6e<\/p>\n<p>conn\/<br \/>\n\u2514\u2500\u2500 minio_conn.py<br \/>\n    # MinIO \u8fde\u63a5\u3001\u4e0a\u4f20\u3001\u751f\u6210\u4e0b\u8f7d\u94fe\u63a5<\/p>\n<p>content\/<br \/>\n\u2514\u2500\u2500 middles\/<br \/>\n    \u2514\u2500\u2500 file_manager_middle.py<br \/>\n        # Agent \u6267\u884c\u7ed3\u675f\u540e\u7684\u6587\u4ef6\u5904\u7406<\/p>\n<p>utils\/<br \/>\n\u2514\u2500\u2500 doc_utils\/<br \/>\n    \u2514\u2500\u2500 zip_files.py<br \/>\n        # \u5de5\u4f5c\u76ee\u5f55\u538b\u7f29<\/p>\n<h3>10. \u5c0f\u7ed3<\/h3>\n<p>\u8fd9\u4e00\u90e8\u5206\u5b9e\u9645\u4e0a\u6ca1\u6709\u6539\u53d8 Agent \u539f\u6765\u7684\u6587\u4ef6\u5904\u7406\u65b9\u5f0f&#xff0c;\u53ea\u662f\u5728\u539f\u6765\u7684\u5de5\u4f5c\u76ee\u5f55\u540e\u9762\u589e\u52a0\u4e86\u4e00\u4e2a\u6587\u4ef6\u4ea4\u4ed8\u6d41\u7a0b&#xff1a;<\/p>\n<p>Agent\u5de5\u4f5c\u76ee\u5f55<br \/>\n      \u2193<br \/>\n\u68c0\u6d4b\u65b0\u6587\u4ef6<br \/>\n      \u2193<br \/>\nZIP<br \/>\n      \u2193<br \/>\nMinIO<br \/>\n      \u2193<br \/>\nPresigned URL<br \/>\n      \u2193<br \/>\n\u7528\u6237<\/p>\n<p>Agent \u7ee7\u7eed\u5728\u81ea\u5df1\u7684\u5de5\u4f5c\u76ee\u5f55\u4e2d\u64cd\u4f5c\u6587\u4ef6&#xff0c;Middleware \u8d1f\u8d23\u5728\u4efb\u52a1\u7ed3\u675f\u540e\u628a\u6587\u4ef6\u6574\u7406\u5e76\u4ea4\u7ed9\u7528\u6237\u3002\u8fd9\u6837\u6587\u4ef6\u751f\u6210\u548c\u6587\u4ef6\u4f20\u9012\u5c31\u5206\u5f00\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u95ee\u9898\u76ee\u524d Agent \u5df2\u7ecf\u53ef\u4ee5\u5728\u5de5\u4f5c\u76ee\u5f55\u4e2d\u521b\u5efa\u548c\u5904\u7406\u6587\u4ef6&#xff0c;\u4f46\u8fd9\u4e9b\u6587\u4ef6\u90fd\u4fdd\u5b58\u5728\u540e\u7aef\u670d\u52a1\u5668\u4e0a&#xff0c;\u524d\u7aef\u65e0\u6cd5\u76f4\u63a5\u8bbf\u95ee\u3002\u56e0\u6b64\u9700\u8981\u589e\u52a0\u4e00\u4e2a\u4e2d\u95f4\u73af\u8282&#xff0c;\u628a Agent \u751f\u6210\u7684\u6587\u4ef6\u4ea4\u7ed9\u7528\u6237\u3002\u8fd9\u91cc\u91c7\u7528\u5bf9\u8c61\u5b58\u50a8\u7684\u65b9\u5f0f&#xff1a;Agent\u751f\u6210\u6587\u4ef6\u2193<br \/>\n\u5de5\u4f5c\u76ee\u5f55\u2193<br \/>\n\u6253\u5305\u2193<br \/>\nMinIO\u2193<br \/>\n\u751f\u6210\u4e0b\u8f7d\u94fe\u63a5\u2193<br \/>\n\u524d\u7aef\u4e0b\u8f7d\u8fd9\u6837 Agent \u4ecd\u7136\u53ea\u8d1f\u8d23\u5904\u7406\u81ea\u5df1\u7684\u5de5\u4f5c\u76ee\u5f55&#xff0c;\u6587\u4ef6\u4ea4\u4ed8\u7531\u540e\u7eed\u6d41\u7a0b\u5b8c\u6210\u30022. \u5bf9\u8c61\u5b58\u50a8**\u5bf9\u8c61\u5b58\u50a8&#xff08;Object S<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[81,50,305],"topic":[],"class_list":["post-97143","post","type-post","status-publish","format-standard","hentry","category-server","tag-python","tag-50","tag-305"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Agent \u6587\u4ef6\u4f20\u9012 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/97143.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Agent \u6587\u4ef6\u4f20\u9012 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"1. \u95ee\u9898\u76ee\u524d Agent \u5df2\u7ecf\u53ef\u4ee5\u5728\u5de5\u4f5c\u76ee\u5f55\u4e2d\u521b\u5efa\u548c\u5904\u7406\u6587\u4ef6&#xff0c;\u4f46\u8fd9\u4e9b\u6587\u4ef6\u90fd\u4fdd\u5b58\u5728\u540e\u7aef\u670d\u52a1\u5668\u4e0a&#xff0c;\u524d\u7aef\u65e0\u6cd5\u76f4\u63a5\u8bbf\u95ee\u3002\u56e0\u6b64\u9700\u8981\u589e\u52a0\u4e00\u4e2a\u4e2d\u95f4\u73af\u8282&#xff0c;\u628a Agent \u751f\u6210\u7684\u6587\u4ef6\u4ea4\u7ed9\u7528\u6237\u3002\u8fd9\u91cc\u91c7\u7528\u5bf9\u8c61\u5b58\u50a8\u7684\u65b9\u5f0f&#xff1a;Agent\u751f\u6210\u6587\u4ef6\u2193 \u5de5\u4f5c\u76ee\u5f55\u2193 \u6253\u5305\u2193 MinIO\u2193 \u751f\u6210\u4e0b\u8f7d\u94fe\u63a5\u2193 \u524d\u7aef\u4e0b\u8f7d\u8fd9\u6837 Agent \u4ecd\u7136\u53ea\u8d1f\u8d23\u5904\u7406\u81ea\u5df1\u7684\u5de5\u4f5c\u76ee\u5f55&#xff0c;\u6587\u4ef6\u4ea4\u4ed8\u7531\u540e\u7eed\u6d41\u7a0b\u5b8c\u6210\u30022. \u5bf9\u8c61\u5b58\u50a8**\u5bf9\u8c61\u5b58\u50a8&#xff08;Object S\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/97143.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-28T19:56:35+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/97143.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/97143.html\",\"name\":\"Agent \u6587\u4ef6\u4f20\u9012 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-28T19:56:35+00:00\",\"dateModified\":\"2026-08-28T19:56:35+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/97143.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/97143.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/97143.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Agent \u6587\u4ef6\u4f20\u9012\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Agent \u6587\u4ef6\u4f20\u9012 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/97143.html","og_locale":"zh_CN","og_type":"article","og_title":"Agent \u6587\u4ef6\u4f20\u9012 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"1. \u95ee\u9898\u76ee\u524d Agent \u5df2\u7ecf\u53ef\u4ee5\u5728\u5de5\u4f5c\u76ee\u5f55\u4e2d\u521b\u5efa\u548c\u5904\u7406\u6587\u4ef6&#xff0c;\u4f46\u8fd9\u4e9b\u6587\u4ef6\u90fd\u4fdd\u5b58\u5728\u540e\u7aef\u670d\u52a1\u5668\u4e0a&#xff0c;\u524d\u7aef\u65e0\u6cd5\u76f4\u63a5\u8bbf\u95ee\u3002\u56e0\u6b64\u9700\u8981\u589e\u52a0\u4e00\u4e2a\u4e2d\u95f4\u73af\u8282&#xff0c;\u628a Agent \u751f\u6210\u7684\u6587\u4ef6\u4ea4\u7ed9\u7528\u6237\u3002\u8fd9\u91cc\u91c7\u7528\u5bf9\u8c61\u5b58\u50a8\u7684\u65b9\u5f0f&#xff1a;Agent\u751f\u6210\u6587\u4ef6\u2193 \u5de5\u4f5c\u76ee\u5f55\u2193 \u6253\u5305\u2193 MinIO\u2193 \u751f\u6210\u4e0b\u8f7d\u94fe\u63a5\u2193 \u524d\u7aef\u4e0b\u8f7d\u8fd9\u6837 Agent \u4ecd\u7136\u53ea\u8d1f\u8d23\u5904\u7406\u81ea\u5df1\u7684\u5de5\u4f5c\u76ee\u5f55&#xff0c;\u6587\u4ef6\u4ea4\u4ed8\u7531\u540e\u7eed\u6d41\u7a0b\u5b8c\u6210\u30022. \u5bf9\u8c61\u5b58\u50a8**\u5bf9\u8c61\u5b58\u50a8&#xff08;Object S","og_url":"https:\/\/www.wsisp.com\/helps\/97143.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-28T19:56:35+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/97143.html","url":"https:\/\/www.wsisp.com\/helps\/97143.html","name":"Agent \u6587\u4ef6\u4f20\u9012 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-28T19:56:35+00:00","dateModified":"2026-08-28T19:56:35+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/97143.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/97143.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/97143.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Agent \u6587\u4ef6\u4f20\u9012"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/97143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=97143"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/97143\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=97143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=97143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=97143"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=97143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}