云服务器Flexus X实例:部署 AgentOps,全方位监测智能体

B站影视 2024-12-27 20:54 1

摘要:通过深入体验华为云的 Flexus云服务器X实例,我发现它不仅提供了直接通过公网访问的便利性,还支持高效的内容复制粘贴功能,使得操作更加流畅。此外,Flexus云服务器X实例 的弹性伸缩能力,搭配弹性伸缩服务AS和负载均衡服务ELB,使得在部署多智能体监控 A

通过深入体验华为云的 Flexus云服务器X实例,我发现它不仅提供了直接通过公网访问的便利性,还支持高效的内容复制粘贴功能,使得操作更加流畅。此外,Flexus云服务器X实例 的弹性伸缩能力,搭配弹性伸缩服务AS和负载均衡服务ELB,使得在部署多智能体监控 AgentOps 时,能够灵活应对业务负载的变化,确保系统的稳定运行。其高可用性和安全性,通过搭配华为云数据库服务和网络安全服务如WAF、DDoS,为 AgentOps 提供了一个安全可靠的运行环境。同时,云服务器的高计算可用性和存储持久化性,保障了 AgentOps 的可靠性和数据的安全性。综合来看,Flexus云服务器X实例 为多智能体监控 AgentOps 的部署提供了一个高效、灵活、安全的平台。点击这里快速体验~

一、什么是 AgentOps ?

AgentOps 帮助开发人员构建、评估和监控 AI 代理。

主要特性如下:

(1)重放分析和调试:可以查看代理逐步执行图;

(2)LLM成本管理:跟踪 LLM 基础模型提供商的支出;

(3)代理基准测试:根据 1,000 多个评估测试您的代理;

(4)检测合规性和安全性:检测常见的即时注入和数据泄露漏洞;

(5)框架集成:与 CrewAI、AutoGen 和 LangChain 的原生集成;

下面就开始部署 AgentOps 吧!

二、部署 AgentOps

2.1 安装 AgentOps

首先,安装 agentops 安装包,如下所示。

root@flexusx-7305:~# source autogentest/bin/activate

(autogentest) root@flexusx-7305:~# pip install agentops

Collecting agentops

Downloading agentops-0.3.10-py3-none-any.whl.metadata (18 kB)

Collecting requests==2.31.0 (from agentops)

Downloading requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)

Collecting psutil==5.9.8 (from agentops)

Downloading psutil-5.9.8-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (21 kB)

Collecting packaging==23.2 (from agentops)

Downloading packaging-23.2-py3-none-any.whl.metadata (3.2 kB)

Requirement already satisfied: termcolor==2.4.0 in ./autogentest/lib/python3.10/site-packages (from agentops) (2.4.0)

Collecting PyYAML==6.0.1 (from agentops)

Downloading PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)

Requirement already satisfied: charset-normalizer=2 in ./autogentest/lib/python3.10/site-packages (from requests==2.31.0->agentops) (3.3.2)

Requirement already satisfied: idna=2.5 in ./autogentest/lib/python3.10/site-packages (from requests==2.31.0->agentops) (3.9)

Requirement already satisfied: urllib3=1.21.1 in ./autogentest/lib/python3.10/site-packages (from requests==2.31.0->agentops) (2.2.3)

Requirement already satisfied: certifi>=2017.4.17 in ./autogentest/lib/python3.10/site-packages (from requests==2.31.0->agentops) (2024.8.30)

Downloading agentops-0.3.10-py3-none-any.whl (41 kB)

Downloading packaging-23.2-py3-none-any.whl (53 kB)

Downloading psutil-5.9.8-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (288 kB)

Downloading PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (705 kB)

705.5/705.5 kB 7.9 MB/s eta 0:00:00

Downloading requests-2.31.0-py3-none-any.whl (62 kB)

Installing collected packages: requests, PyYAML, psutil, packaging, agentops

Attempting uninstall: requests

Found existing installation: requests 2.32.3

Uninstalling requests-2.32.3:

Successfully uninstalled requests-2.32.3

Attempting uninstall: PyYAML

Found existing installation: PyYAML 6.0.2

Uninstalling PyYAML-6.0.2:

Successfully uninstalled PyYAML-6.0.2

Attempting uninstall: packaging

Found existing installation: packaging 24.1

Uninstalling packaging-24.1:

Successfully uninstalled packaging-24.1

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

arxiv 2.1.3 requires requests~=2.32.0, but you have requests 2.31.0 which is incompatible.

Successfully installed PyYAML-6.0.1 agentops-0.3.10 packaging-23.2 psutil-5.9.8 requests-2.31.0

(autogentest) root@flexusx-7305:~#

2.2 注册账号

点击这里注册账号,可以通过 Github 或者其他方式直接授权登录,登录后如下所示。

2.3 生成 API_KEY

依次点击侧边栏 -> API keys,复制 API key,如下所示。

点击 Copy API Key 复制 API Key。

下面就来运行一个 AgentOps 实例。

三、AgentOps 实例

3.1 创建实例

创建文件 test_agentops.py,文件内容如下。

import agentops

from autogen import ConversableAgent, UserProxyAgent, config_list_from_json

# When initializing AgentOps, you can pass in optional tags to help filter sessions

agentops.init(api_key="",default_tags=["simple-autogen-example"])

# Create the agent that uses the LLM.

llm_config = {"model": "",

"api_key": "",

"base_url": ""}

assistant = ConversableAgent("agent",

llm_config=llm_config)

# Create the agent that represents the user in the conversation.

user_proxy = UserProxyAgent("user",

code_execution_config=False)

# Let the assistant start the conversation. It will end when the user types "exit".

user_proxy.initiate_chat(assistant,

message="北京有哪些景点?",

max_turns=1)

# Close your AgentOps session to indicate that it completed.

agentops.end_session("Success")

3.2 运行实例

执行如下命令运行 test_agentops.py。

AgentOps: Session Replay: https://app.agentops.ai/drilldown?session_id=XXXXX

user (to agent):

北京有哪些景点?

>>>>>>>> USING AUTO REPLY...

agent (to user):

北京有许多著名的景点,包括天安门广场、故宫、万里长城等。

🖇 AgentOps: This run's cost $0.00

🖇 AgentOps: Session Replay: https://app.agentops.ai/drilldown?session_id=XXXXXX

四、总结

通过在 华为云的 Flexus云服务器X实例 中部署 AgentOps,不仅实现了对多智能体对话框架 AutoGen 的高效监控,还深刻体验到了 Flexus云服务器X实例 的卓越性能。Flexus云服务器X实例 通过其强大的计算能力和高并发处理性能,确保了AutoGen 框架在面对大量并发请求时的稳定运行。同时,得益于其弹性伸缩服务AS和负载均衡服务ELB,我们能够根据实时业务需求快速调整资源,保持系统的流畅性和响应速度。

在安全性方面,Flexus云服务器X实例 提供了全方位的安全防护,包括WAF、DDoS等网络安全服务,有效降低了黑客入侵的风险,保障了 AutoGen 框架的数据安全和业务连续性。此外,云服务器的高可用性设计,如跨可用区部署和容灾能力,确保了服务的不间断运行,即使在面对突发情况时也能保持业务的稳定性。

总体而言,Flexus云服务器X实例 以其高性能、高安全性和高便利性,为 AutoGen 框架的稳定运行和监控提供了坚实的基础。

来源:互联网播客

相关推荐