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 相關的分數和回饋。