This commit is contained in:
Kofo Okesola 2025-09-23 07:52:29 +01:00
commit 1ca930a6d0
2 changed files with 74 additions and 0 deletions

69
confs/agent.yml Normal file
View File

@ -0,0 +1,69 @@
id: db_agent
http:
listenPath: db_agent
method: POST
next: $conditional.validate
conditionals:
validate:
expression: |
{{
notempty (param "query") "Query" true
}}
validPath: $action.agent
invalidPath: $response.400
actions:
agent:
type: agent
config:
integrationID: openai
userPrompt: '{{ param "query" }}'
systemPrompt: |
You are a helpful agent to assist the user interact and query data from a mongodb database.
You have access to a mongodb querier tool that allows you fetch data using filter and projection queries on the collection "users".
The collection has the fields name, email, id (uuid).
*IMPORTANT* Never include password queries in your responses
toolConfigs:
- type: workflow
workflowConfig:
name: mongodbquerier
description: |
Accepts a filter query in the form of json and a projection in the form of json and performs queries on the collection "users"
params: ["filter", "projection"]
returnValue: '{{ jsonout .variable_actions_queryDB}}'
start: "$action.queryDB"
history: true
next: $response.200
queryDB:
type: mongoquery
config:
collection: users
filter: '{{ tool_param "filter" | stringescape }}'
projection: '{{ tool_param "projection" | stringescape }}'
integrationID: "mongo"
responses:
"200":
type: json
responseObject:
fields:
response:
value: "{{ .variable_actions_agent }}"
code: 200
"400":
type: json
template: |
{
"errors": {{ .error }}
}
code: 400
exists:
type: json
template: |
{
"errors": ["user already exists"]
}
code: 400

View File

@ -0,0 +1,5 @@
- id: mongo
type: mongo
config:
connectionString: '{{ secret "MONGODB_STRING" }}'
dbName: test