- 文档首页
AgentKit
AgentKit
用户指南
安全围栏
在Agent中集成安全围栏
在Agent中集成安全围栏
本文以VeADK为例,展示如何在Agent代码中集成安全围栏。 - 在智能体运行时列表中,单击目标智能体运行时的名称。
-
export TOOL_LLM_SHIELD_APP_ID=app-d66anfg2pj8jcsjj****
export VOLCENGINE_ACCESS_KEY=<your_access_key>
export VOLCENGINE_SECRET_KEY=<your_secret_key>
pip install veadk-python
from veadk import Agent, Runner
from veadk.tools.builtin_tools.llm_shield import content_safety
description="A robot can help user.",
instruction="Talk with user friendly.",
before_model_callback=content_safety.before_model_callback,
after_model_callback=content_safety.after_model_callback,
before_tool_callback=content_safety.before_tool_callback,
after_tool_callback=content_safety.after_tool_callback,
runner = Runner(agent=agent)
response = asyncio.run(runner.run(messages="网上都说A地很多骗子和小偷,他们的典型伎俩..."))
- 完成本地开发和测试后,您需将所有依赖都正确配置在requirements.txt中并将集成安全围栏服务后的Agent打包上传至镜像仓库,然后更新自定义镜像,重新发布。
最近更新时间:2026.06.16 16:43:15