GenAI 代理的世界是支离破碎的,LangGraph、AWS Bedrock 和 Semantic Kernel 等框架都在自己的孤岛中运行。这种互操作性的缺乏给需要跨不同平台、API 或遗留系统集成代理的开发人员和企业造成了障碍。
AgenticDB 作为统一这种分散环境的解决方案而出现。它是专门设计用于存储和管理 GenAI 代理和应用程序清单的数据库。借助 AgenticDB,您可以轻松地从集中存储库添加、搜索、调用代理并对其进行评级。基于 Docker 的代理管理和远程执行等高级功能扩展了其多功能性,使其适用于各种 GenAI 工作流程。
通过简化我们处理代理的方式,AgenticDB 不仅可以节省时间,还可以更轻松地为任何任务找到和使用合适的代理,从而促进创新。它是连接不同框架的桥梁,实现无缝协作并加速 GenAI 生态系统的进步。
使用AgenticDB ,您可以:
要在本地启动 AgenticDB 服务器,请运行以下命令:
python server.py
该 API 将在http://127.0.0.1:8000
上提供。
以下是自述文件中“删除所有集合”部分的更新版本,反映了所提供的 Python 代码中的实际 JSON 响应格式。
您可以使用以下curl
命令将代理添加到数据库。此示例发送一个 JSON 请求以添加名为code-gen-chart-agent
新代理。
curl -X POST " http://127.0.0.1:8000/agents "
-H " Content-Type: application/json "
-H " Accept: application/json "
-d ' [
{
"metadata": {
"name": "code-gen-chart-agent",
"namespace": "agents",
"description": "Requests for a javascript code generator to plot a chart with supplied free-form data."
},
"spec": {
"type": "agent",
"lifecycle": "dev",
"owner": "[email protected]",
"access_level": "Public",
"category": "Travel Agent",
"url": "https://api.example.com/code-gen-chart-agent/agent",
"parameters": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The request message for the chart code generator agent."
},
"thread": {
"type": "string",
"description": "The id to separate parallel message threads."
}
},
"required": ["message", "thread"],
"additionalProperties": false
},
"output": {
"type": "string",
"description": "The result of the request, including any generated image location."
}
}
}
] '
这会将代理清单添加到 AgenticDB,使其可用于将来的搜索和调用。
要根据自然语言查询搜索代理,请使用以下curl
命令。此示例搜索与“自然语言”相关的代理。
curl -G " http://127.0.0.1:8000/agents "
-H " Accept: application/json "
--data-urlencode " query=Which agents can book travel? "
AgenticDB 将执行相似性搜索并根据查询返回匹配代理的列表。
您还可以使用类似的curl
命令将代理应用程序添加到AgenticDB。以下是添加跟踪股票价格并生成图表的“股票价格图表应用程序”的示例。
curl -X POST " http://127.0.0.1:8000/applications "
-H " Content-Type: application/json "
-H " Accept: application/json "
-d ' [
{
"metadata": {
"name": "Stock Price Charting Application",
"namespace": "production",
"description": "Provides access to daily open, high, low, close stock prices over time and the ability to generate charts for the requested data"
},
"spec": {
"type": "application",
"lifecycle": "dev",
"owner": "[email protected]",
"access_level": "PUBLIC",
"category": "Finance",
"setup": {
"compose": {
"compose_url": "https://ipfs.filebase.io/ipfs/somehash",
"run_command": "gunzip docker-compose.yml.gz && docker compose -f ./docker-compose.yml up -d"
}
},
"url": "http://localhost:3000/agent",
"method": "POST",
"example": "http://localhost:3000/agent ' Content-Type ' : ' application/json ' { ' input ' : ' what was the Nvidia close price on August 22nd 2024 ' , ' thread ' : ' nvidia ' }",
"parameters": {
"type": "object",
"properties": {
"input": {
"type": "string",
"description": "natural language request for stock price data and charting of the data as required"
},
"thread": {
"type": "string",
"description": "thread context id for the request"
}
},
"required": ["input"],
"additionalProperties": false
},
"output": {
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "the natural language response and the Final Answer to the request with a chart location if requested"
}
},
"description": "the answer to the request"
}
}
}
] '
您可以使用单个DELETE
请求从 AgenticDB 中删除所有代理、应用程序和评级集合。此操作将尝试删除存储的集合: agents
、 applications
和ratings
。每个集合删除都是单独处理的,结果将反映每个集合是否删除成功。
curl -X DELETE " http://127.0.0.1:8000/collections "
响应将以 JSON 对象的形式提供每次删除尝试的状态。如果成功删除集合,该值将为0
。如果出现错误,该值将包含相应的错误消息。
{
"agents" : 0 ,
"applications" : 0 ,
"ratings" : " Failed to delete ratings collection: some_error_message "
}
0
表示agents
集合已成功删除。0
表示applications
集合已成功删除。"some_error_message"
替换为遇到的实际错误)。 与代理交互后,您可以使用此curl
命令提交代理的评级。将placeholder_agent_id
和placeholder_some_id
替换为实际的代理 ID 和评级 ID。
curl -X POST " http://127.0.0.1:8000/ratings "
-H " Content-Type: application/json "
-d ' {
"ratings": {
"agent_id": "placeholder_agent_id",
"id": "placeholder_some_id",
"data": {
"score": 4
}
}
} '
您可以使用此curl
命令检索代理评级。将<ratings_id>
替换为实际的评级 ID。
curl -X GET " http://127.0.0.1:8000/ratings?ratings_id=<ratings_id> "
AgenticDB 将返回与所提供的评级 ID 相关的分数和反馈。