beddel 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/README.md +117 -14
- package/dist/agents/chat/chat.handler.d.ts +12 -0
- package/dist/agents/chat/chat.handler.d.ts.map +1 -0
- package/dist/agents/chat/chat.handler.js +145 -0
- package/dist/agents/chat/chat.handler.js.map +1 -0
- package/dist/agents/chat/chat.schema.d.ts +38 -0
- package/dist/agents/chat/chat.schema.d.ts.map +1 -0
- package/dist/agents/chat/chat.schema.js +31 -0
- package/dist/agents/chat/chat.schema.js.map +1 -0
- package/dist/agents/chat/chat.types.d.ts +42 -0
- package/dist/agents/chat/chat.types.d.ts.map +1 -0
- package/dist/agents/chat/chat.types.js +6 -0
- package/dist/agents/chat/chat.types.js.map +1 -0
- package/dist/agents/chat/chat.yaml +148 -0
- package/dist/agents/chat/index.d.ts +16 -0
- package/dist/agents/chat/index.d.ts.map +1 -0
- package/dist/agents/chat/index.js +21 -0
- package/dist/agents/chat/index.js.map +1 -0
- package/dist/agents/chromadb/chromadb.handler.d.ts +12 -0
- package/dist/agents/chromadb/chromadb.handler.d.ts.map +1 -0
- package/dist/agents/chromadb/chromadb.handler.js +139 -0
- package/dist/agents/chromadb/chromadb.handler.js.map +1 -0
- package/dist/agents/chromadb/chromadb.schema.d.ts +36 -0
- package/dist/agents/chromadb/chromadb.schema.d.ts.map +1 -0
- package/dist/agents/chromadb/chromadb.schema.js +33 -0
- package/dist/agents/chromadb/chromadb.schema.js.map +1 -0
- package/dist/agents/chromadb/chromadb.types.d.ts +49 -0
- package/dist/agents/chromadb/chromadb.types.d.ts.map +1 -0
- package/dist/agents/chromadb/chromadb.types.js +6 -0
- package/dist/agents/chromadb/chromadb.types.js.map +1 -0
- package/dist/agents/chromadb/chromadb.yaml +128 -0
- package/dist/agents/chromadb/index.d.ts +15 -0
- package/dist/agents/chromadb/index.d.ts.map +1 -0
- package/dist/agents/chromadb/index.js +20 -0
- package/dist/agents/chromadb/index.js.map +1 -0
- package/dist/agents/gemini-vectorize/gemini-vectorize.handler.d.ts +8 -0
- package/dist/agents/gemini-vectorize/gemini-vectorize.handler.d.ts.map +1 -0
- package/dist/agents/gemini-vectorize/gemini-vectorize.handler.js +61 -0
- package/dist/agents/gemini-vectorize/gemini-vectorize.handler.js.map +1 -0
- package/dist/agents/gemini-vectorize/gemini-vectorize.schema.d.ts +22 -0
- package/dist/agents/gemini-vectorize/gemini-vectorize.schema.d.ts.map +1 -0
- package/dist/agents/gemini-vectorize/gemini-vectorize.schema.js +20 -0
- package/dist/agents/gemini-vectorize/gemini-vectorize.schema.js.map +1 -0
- package/dist/agents/gemini-vectorize/gemini-vectorize.types.d.ts +32 -0
- package/dist/agents/gemini-vectorize/gemini-vectorize.types.d.ts.map +1 -0
- package/dist/agents/gemini-vectorize/gemini-vectorize.types.js +6 -0
- package/dist/agents/gemini-vectorize/gemini-vectorize.types.js.map +1 -0
- package/dist/agents/gemini-vectorize/gemini-vectorize.yaml +84 -0
- package/dist/agents/gemini-vectorize/index.d.ts +15 -0
- package/dist/agents/gemini-vectorize/index.d.ts.map +1 -0
- package/dist/agents/gemini-vectorize/index.js +20 -0
- package/dist/agents/gemini-vectorize/index.js.map +1 -0
- package/dist/agents/gitmcp/gitmcp.handler.d.ts +12 -0
- package/dist/agents/gitmcp/gitmcp.handler.d.ts.map +1 -0
- package/dist/agents/gitmcp/gitmcp.handler.js +95 -0
- package/dist/agents/gitmcp/gitmcp.handler.js.map +1 -0
- package/dist/agents/gitmcp/gitmcp.schema.d.ts +17 -0
- package/dist/agents/gitmcp/gitmcp.schema.d.ts.map +1 -0
- package/dist/agents/gitmcp/gitmcp.schema.js +18 -0
- package/dist/agents/gitmcp/gitmcp.schema.js.map +1 -0
- package/dist/agents/gitmcp/gitmcp.types.d.ts +31 -0
- package/dist/agents/gitmcp/gitmcp.types.d.ts.map +1 -0
- package/dist/agents/gitmcp/gitmcp.types.js +6 -0
- package/dist/agents/gitmcp/gitmcp.types.js.map +1 -0
- package/dist/agents/gitmcp/gitmcp.yaml +71 -0
- package/dist/agents/gitmcp/index.d.ts +16 -0
- package/dist/agents/gitmcp/index.d.ts.map +1 -0
- package/dist/agents/gitmcp/index.js +21 -0
- package/dist/agents/gitmcp/index.js.map +1 -0
- package/dist/agents/image/image.handler.d.ts +8 -0
- package/dist/agents/image/image.handler.d.ts.map +1 -0
- package/dist/agents/image/image.handler.js +69 -0
- package/dist/agents/image/image.handler.js.map +1 -0
- package/dist/agents/image/image.schema.d.ts +29 -0
- package/dist/agents/image/image.schema.d.ts.map +1 -0
- package/dist/agents/image/image.schema.js +26 -0
- package/dist/agents/image/image.schema.js.map +1 -0
- package/dist/agents/image/image.types.d.ts +43 -0
- package/dist/agents/image/image.types.d.ts.map +1 -0
- package/dist/agents/image/image.types.js +6 -0
- package/dist/agents/image/image.types.js.map +1 -0
- package/{src/agents/image-agent.yaml → dist/agents/image/image.yaml} +21 -21
- package/dist/agents/image/index.d.ts +14 -0
- package/dist/agents/image/index.d.ts.map +1 -0
- package/dist/agents/image/index.js +19 -0
- package/dist/agents/image/index.js.map +1 -0
- package/dist/agents/index.d.ts +104 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +82 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/joker/index.d.ts +14 -0
- package/dist/agents/joker/index.d.ts.map +1 -0
- package/dist/agents/joker/index.js +19 -0
- package/dist/agents/joker/index.js.map +1 -0
- package/dist/agents/joker/joker.handler.d.ts +8 -0
- package/dist/agents/joker/joker.handler.d.ts.map +1 -0
- package/dist/agents/joker/joker.handler.js +44 -0
- package/dist/agents/joker/joker.handler.js.map +1 -0
- package/dist/agents/joker/joker.schema.d.ts +12 -0
- package/dist/agents/joker/joker.schema.d.ts.map +1 -0
- package/dist/agents/joker/joker.schema.js +13 -0
- package/dist/agents/joker/joker.schema.js.map +1 -0
- package/dist/agents/joker/joker.types.d.ts +36 -0
- package/dist/agents/joker/joker.types.d.ts.map +1 -0
- package/dist/agents/joker/joker.types.js +6 -0
- package/dist/agents/joker/joker.types.js.map +1 -0
- package/{src/agents/joker-agent.yaml → dist/agents/joker/joker.yaml} +4 -4
- package/dist/agents/llm/index.d.ts +15 -0
- package/dist/agents/llm/index.d.ts.map +1 -0
- package/dist/agents/llm/index.js +20 -0
- package/dist/agents/llm/index.js.map +1 -0
- package/dist/agents/llm/llm.handler.d.ts +8 -0
- package/dist/agents/llm/llm.handler.d.ts.map +1 -0
- package/dist/agents/llm/llm.handler.js +64 -0
- package/dist/agents/llm/llm.handler.js.map +1 -0
- package/dist/agents/llm/llm.schema.d.ts +26 -0
- package/dist/agents/llm/llm.schema.d.ts.map +1 -0
- package/dist/agents/llm/llm.schema.js +23 -0
- package/dist/agents/llm/llm.schema.js.map +1 -0
- package/dist/agents/llm/llm.types.d.ts +34 -0
- package/dist/agents/llm/llm.types.d.ts.map +1 -0
- package/dist/agents/llm/llm.types.js +7 -0
- package/dist/agents/llm/llm.types.js.map +1 -0
- package/dist/agents/llm/llm.yaml +87 -0
- package/dist/agents/mcp-tool/index.d.ts +14 -0
- package/dist/agents/mcp-tool/index.d.ts.map +1 -0
- package/dist/agents/mcp-tool/index.js +19 -0
- package/dist/agents/mcp-tool/index.js.map +1 -0
- package/dist/agents/mcp-tool/mcp-tool.handler.d.ts +12 -0
- package/dist/agents/mcp-tool/mcp-tool.handler.d.ts.map +1 -0
- package/dist/agents/mcp-tool/mcp-tool.handler.js +116 -0
- package/dist/agents/mcp-tool/mcp-tool.handler.js.map +1 -0
- package/dist/agents/mcp-tool/mcp-tool.schema.d.ts +19 -0
- package/dist/agents/mcp-tool/mcp-tool.schema.d.ts.map +1 -0
- package/dist/agents/mcp-tool/mcp-tool.schema.js +20 -0
- package/dist/agents/mcp-tool/mcp-tool.schema.js.map +1 -0
- package/dist/agents/mcp-tool/mcp-tool.types.d.ts +31 -0
- package/dist/agents/mcp-tool/mcp-tool.types.d.ts.map +1 -0
- package/dist/agents/mcp-tool/mcp-tool.types.js +6 -0
- package/dist/agents/mcp-tool/mcp-tool.types.js.map +1 -0
- package/dist/agents/mcp-tool/mcp-tool.yaml +71 -0
- package/dist/agents/rag/index.d.ts +15 -0
- package/dist/agents/rag/index.d.ts.map +1 -0
- package/dist/agents/rag/index.js +20 -0
- package/dist/agents/rag/index.js.map +1 -0
- package/dist/agents/rag/rag.handler.d.ts +9 -0
- package/dist/agents/rag/rag.handler.d.ts.map +1 -0
- package/dist/agents/rag/rag.handler.js +78 -0
- package/dist/agents/rag/rag.handler.js.map +1 -0
- package/dist/agents/rag/rag.schema.d.ts +27 -0
- package/dist/agents/rag/rag.schema.d.ts.map +1 -0
- package/dist/agents/rag/rag.schema.js +24 -0
- package/dist/agents/rag/rag.schema.js.map +1 -0
- package/dist/agents/rag/rag.types.d.ts +42 -0
- package/dist/agents/rag/rag.types.d.ts.map +1 -0
- package/dist/agents/rag/rag.types.js +7 -0
- package/dist/agents/rag/rag.types.js.map +1 -0
- package/dist/agents/rag/rag.yaml +89 -0
- package/dist/agents/{agentRegistry.d.ts → registry/agentRegistry.d.ts} +30 -1
- package/dist/agents/registry/agentRegistry.d.ts.map +1 -0
- package/dist/agents/{agentRegistry.js → registry/agentRegistry.js} +187 -5
- package/dist/agents/registry/agentRegistry.js.map +1 -0
- package/dist/agents/registry/index.d.ts +6 -0
- package/dist/agents/registry/index.d.ts.map +1 -0
- package/dist/agents/registry/index.js +10 -0
- package/dist/agents/registry/index.js.map +1 -0
- package/dist/agents/translator/index.d.ts +14 -0
- package/dist/agents/translator/index.d.ts.map +1 -0
- package/dist/agents/translator/index.js +19 -0
- package/dist/agents/translator/index.js.map +1 -0
- package/dist/agents/translator/translator.handler.d.ts +8 -0
- package/dist/agents/translator/translator.handler.d.ts.map +1 -0
- package/dist/agents/translator/translator.handler.js +81 -0
- package/dist/agents/translator/translator.handler.js.map +1 -0
- package/dist/agents/translator/translator.schema.d.ts +27 -0
- package/dist/agents/translator/translator.schema.d.ts.map +1 -0
- package/dist/agents/translator/translator.schema.js +28 -0
- package/dist/agents/translator/translator.schema.js.map +1 -0
- package/dist/agents/translator/translator.types.d.ts +41 -0
- package/dist/agents/translator/translator.types.d.ts.map +1 -0
- package/dist/agents/translator/translator.types.js +6 -0
- package/dist/agents/translator/translator.types.js.map +1 -0
- package/{src/agents/translator-agent.yaml → dist/agents/translator/translator.yaml} +27 -27
- package/dist/client/index.d.ts +89 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +93 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/types.d.ts +17 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +7 -0
- package/dist/client/types.js.map +1 -0
- package/dist/firebase/tenantManager.d.ts +34 -2
- package/dist/firebase/tenantManager.d.ts.map +1 -1
- package/dist/firebase/tenantManager.js +67 -1
- package/dist/firebase/tenantManager.js.map +1 -1
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -7
- package/dist/index.js.map +1 -1
- package/dist/runtime/declarativeAgentRuntime.d.ts +17 -52
- package/dist/runtime/declarativeAgentRuntime.d.ts.map +1 -1
- package/dist/runtime/declarativeAgentRuntime.js +259 -361
- package/dist/runtime/declarativeAgentRuntime.js.map +1 -1
- package/dist/runtime/index.d.ts +14 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +38 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/llmProviderFactory.d.ts +47 -0
- package/dist/runtime/llmProviderFactory.d.ts.map +1 -0
- package/dist/runtime/llmProviderFactory.js +119 -0
- package/dist/runtime/llmProviderFactory.js.map +1 -0
- package/dist/runtime/workflowExecutor.d.ts +31 -0
- package/dist/runtime/workflowExecutor.d.ts.map +1 -0
- package/dist/runtime/workflowExecutor.js +80 -0
- package/dist/runtime/workflowExecutor.js.map +1 -0
- package/dist/server/api/graphql.js +3 -3
- package/dist/server/api/graphql.js.map +1 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/shared/index.d.ts +7 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +23 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/types/agent.types.d.ts +63 -0
- package/dist/shared/types/agent.types.d.ts.map +1 -0
- package/dist/shared/types/agent.types.js +18 -0
- package/dist/shared/types/agent.types.js.map +1 -0
- package/dist/shared/types/execution.types.d.ts +42 -0
- package/dist/shared/types/execution.types.d.ts.map +1 -0
- package/dist/shared/types/execution.types.js +7 -0
- package/dist/shared/types/execution.types.js.map +1 -0
- package/dist/shared/types/index.d.ts +7 -0
- package/dist/shared/types/index.d.ts.map +1 -0
- package/dist/shared/types/index.js +23 -0
- package/dist/shared/types/index.js.map +1 -0
- package/dist/shared/types/schema.types.d.ts +52 -0
- package/dist/shared/types/schema.types.d.ts.map +1 -0
- package/dist/shared/types/schema.types.js +7 -0
- package/dist/shared/types/schema.types.js.map +1 -0
- package/dist/shared/utils/index.d.ts +5 -0
- package/dist/shared/utils/index.d.ts.map +1 -0
- package/dist/shared/utils/index.js +21 -0
- package/dist/shared/utils/index.js.map +1 -0
- package/dist/shared/utils/validation.d.ts +42 -0
- package/dist/shared/utils/validation.d.ts.map +1 -0
- package/dist/shared/utils/validation.js +93 -0
- package/dist/shared/utils/validation.js.map +1 -0
- package/dist/tenant/TenantManager.d.ts +152 -0
- package/dist/tenant/TenantManager.d.ts.map +1 -0
- package/dist/tenant/TenantManager.js +392 -0
- package/dist/tenant/TenantManager.js.map +1 -0
- package/dist/tenant/index.d.ts +47 -0
- package/dist/tenant/index.d.ts.map +1 -0
- package/dist/tenant/index.js +74 -0
- package/dist/tenant/index.js.map +1 -0
- package/dist/tenant/interfaces.d.ts +170 -0
- package/dist/tenant/interfaces.d.ts.map +1 -0
- package/dist/tenant/interfaces.js +67 -0
- package/dist/tenant/interfaces.js.map +1 -0
- package/dist/tenant/providerFactory.d.ts +43 -0
- package/dist/tenant/providerFactory.d.ts.map +1 -0
- package/dist/tenant/providerFactory.js +70 -0
- package/dist/tenant/providerFactory.js.map +1 -0
- package/dist/tenant/providerRegistry.d.ts +47 -0
- package/dist/tenant/providerRegistry.d.ts.map +1 -0
- package/dist/tenant/providerRegistry.js +79 -0
- package/dist/tenant/providerRegistry.js.map +1 -0
- package/dist/tenant/providers/FirebaseTenantProvider.d.ts +41 -0
- package/dist/tenant/providers/FirebaseTenantProvider.d.ts.map +1 -0
- package/dist/tenant/providers/FirebaseTenantProvider.js +290 -0
- package/dist/tenant/providers/FirebaseTenantProvider.js.map +1 -0
- package/dist/tenant/providers/InMemoryTenantProvider.d.ts +18 -0
- package/dist/tenant/providers/InMemoryTenantProvider.d.ts.map +1 -0
- package/dist/tenant/providers/InMemoryTenantProvider.js +137 -0
- package/dist/tenant/providers/InMemoryTenantProvider.js.map +1 -0
- package/package.json +46 -10
- package/src/agents/chat/chat.handler.ts +211 -0
- package/src/agents/chat/chat.schema.ts +33 -0
- package/src/agents/chat/chat.types.ts +46 -0
- package/src/agents/chat/chat.yaml +148 -0
- package/src/agents/chat/index.ts +21 -0
- package/src/agents/chromadb/chromadb.handler.ts +130 -0
- package/src/agents/chromadb/chromadb.schema.ts +35 -0
- package/src/agents/chromadb/chromadb.types.ts +52 -0
- package/src/agents/chromadb/chromadb.yaml +128 -0
- package/src/agents/chromadb/index.ts +20 -0
- package/src/agents/gemini-vectorize/gemini-vectorize.handler.ts +75 -0
- package/src/agents/gemini-vectorize/gemini-vectorize.schema.ts +22 -0
- package/src/agents/gemini-vectorize/gemini-vectorize.types.ts +34 -0
- package/src/agents/gemini-vectorize/gemini-vectorize.yaml +84 -0
- package/src/agents/gemini-vectorize/index.ts +20 -0
- package/src/agents/gitmcp/gitmcp.handler.ts +122 -0
- package/src/agents/gitmcp/gitmcp.schema.ts +20 -0
- package/src/agents/gitmcp/gitmcp.types.ts +33 -0
- package/src/agents/gitmcp/gitmcp.yaml +71 -0
- package/src/agents/gitmcp/index.ts +21 -0
- package/src/agents/image/image.handler.ts +86 -0
- package/src/agents/image/image.schema.ts +28 -0
- package/src/agents/image/image.types.ts +46 -0
- package/src/agents/image/image.yaml +86 -0
- package/src/agents/image/index.ts +19 -0
- package/src/agents/index.ts +63 -0
- package/src/agents/joker/index.ts +19 -0
- package/src/agents/joker/joker.handler.ts +55 -0
- package/src/agents/joker/joker.schema.ts +15 -0
- package/src/agents/joker/joker.types.ts +38 -0
- package/src/agents/joker/joker.yaml +47 -0
- package/src/agents/llm/index.ts +20 -0
- package/src/agents/llm/llm.handler.ts +82 -0
- package/src/agents/llm/llm.schema.ts +25 -0
- package/src/agents/llm/llm.types.ts +37 -0
- package/src/agents/llm/llm.yaml +87 -0
- package/src/agents/mcp-tool/index.ts +19 -0
- package/src/agents/mcp-tool/mcp-tool.handler.ts +112 -0
- package/src/agents/mcp-tool/mcp-tool.schema.ts +22 -0
- package/src/agents/mcp-tool/mcp-tool.types.ts +33 -0
- package/src/agents/mcp-tool/mcp-tool.yaml +71 -0
- package/src/agents/rag/index.ts +20 -0
- package/src/agents/rag/rag.handler.ts +95 -0
- package/src/agents/rag/rag.schema.ts +26 -0
- package/src/agents/rag/rag.types.ts +45 -0
- package/src/agents/rag/rag.yaml +89 -0
- package/src/agents/{agentRegistry.ts → registry/agentRegistry.ts} +195 -6
- package/src/agents/registry/index.ts +6 -0
- package/src/agents/translator/index.ts +19 -0
- package/src/agents/translator/translator.handler.ts +97 -0
- package/src/agents/translator/translator.schema.ts +30 -0
- package/src/agents/translator/translator.types.ts +43 -0
- package/src/agents/translator/translator.yaml +80 -0
- package/src/client/index.ts +53 -0
- package/src/client/types.ts +38 -0
- package/src/index.ts +56 -5
- package/src/runtime/declarativeAgentRuntime.ts +378 -495
- package/src/runtime/index.ts +36 -0
- package/src/runtime/llmProviderFactory.ts +145 -0
- package/src/runtime/workflowExecutor.ts +107 -0
- package/src/server/api/graphql.ts +1 -1
- package/src/server/index.ts +2 -2
- package/src/shared/index.ts +7 -0
- package/src/shared/types/agent.types.ts +100 -0
- package/src/shared/types/execution.types.ts +45 -0
- package/src/shared/types/index.ts +7 -0
- package/src/shared/types/schema.types.ts +55 -0
- package/src/shared/utils/index.ts +5 -0
- package/src/shared/utils/validation.ts +100 -0
- package/src/tenant/TenantManager.ts +488 -0
- package/src/tenant/index.ts +101 -0
- package/src/tenant/interfaces.ts +231 -0
- package/src/tenant/providerFactory.ts +75 -0
- package/src/tenant/providerRegistry.ts +86 -0
- package/src/tenant/providers/InMemoryTenantProvider.ts +168 -0
- package/dist/agents/agentRegistry.d.ts.map +0 -1
- package/dist/agents/agentRegistry.js.map +0 -1
- package/src/firebase/tenantManager.ts +0 -443
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# LLM Agent - Native Builtin Agent for Beddel Runtime
|
|
2
|
+
# Route: /agents/llm
|
|
3
|
+
# Method: llm.execute
|
|
4
|
+
|
|
5
|
+
agent:
|
|
6
|
+
id: llm
|
|
7
|
+
version: 1.0.0
|
|
8
|
+
protocol: beddel-declarative-protocol/v2.0
|
|
9
|
+
|
|
10
|
+
metadata:
|
|
11
|
+
name: "LLM Chat Agent"
|
|
12
|
+
description: "Direct LLM interaction with conversation history support (non-RAG)"
|
|
13
|
+
category: "intelligence"
|
|
14
|
+
route: "/agents/llm"
|
|
15
|
+
tags:
|
|
16
|
+
- "llm"
|
|
17
|
+
- "chat"
|
|
18
|
+
- "gemini"
|
|
19
|
+
- "conversation"
|
|
20
|
+
|
|
21
|
+
schema:
|
|
22
|
+
input:
|
|
23
|
+
type: "object"
|
|
24
|
+
properties:
|
|
25
|
+
query:
|
|
26
|
+
type: "string"
|
|
27
|
+
description: "User message to respond to"
|
|
28
|
+
history:
|
|
29
|
+
type: "array"
|
|
30
|
+
items:
|
|
31
|
+
type: "object"
|
|
32
|
+
properties:
|
|
33
|
+
role:
|
|
34
|
+
type: "string"
|
|
35
|
+
enum: ["user", "assistant", "system"]
|
|
36
|
+
content:
|
|
37
|
+
type: "string"
|
|
38
|
+
description: "Conversation history for context continuity"
|
|
39
|
+
temperature:
|
|
40
|
+
type: "number"
|
|
41
|
+
minimum: 0
|
|
42
|
+
maximum: 2
|
|
43
|
+
default: 0.7
|
|
44
|
+
description: "LLM temperature for response generation"
|
|
45
|
+
systemPrompt:
|
|
46
|
+
type: "string"
|
|
47
|
+
description: "Custom system prompt for the LLM"
|
|
48
|
+
required: ["query"]
|
|
49
|
+
|
|
50
|
+
output:
|
|
51
|
+
type: "object"
|
|
52
|
+
properties:
|
|
53
|
+
response:
|
|
54
|
+
type: "string"
|
|
55
|
+
description: "Generated response"
|
|
56
|
+
timestamp:
|
|
57
|
+
type: "string"
|
|
58
|
+
description: "ISO timestamp of generation"
|
|
59
|
+
error:
|
|
60
|
+
type: "string"
|
|
61
|
+
required: ["response"]
|
|
62
|
+
|
|
63
|
+
logic:
|
|
64
|
+
workflow:
|
|
65
|
+
- name: "generate-response"
|
|
66
|
+
type: "llm"
|
|
67
|
+
action:
|
|
68
|
+
query: "$input.query"
|
|
69
|
+
history: "$input.history"
|
|
70
|
+
temperature: "$input.temperature"
|
|
71
|
+
systemPrompt: "$input.systemPrompt"
|
|
72
|
+
result: "llmResult"
|
|
73
|
+
|
|
74
|
+
- name: "deliver-response"
|
|
75
|
+
type: "output-generator"
|
|
76
|
+
action:
|
|
77
|
+
type: "generate"
|
|
78
|
+
output:
|
|
79
|
+
response: "$llmResult.response"
|
|
80
|
+
timestamp: "$llmResult.timestamp"
|
|
81
|
+
error: "$llmResult.error"
|
|
82
|
+
|
|
83
|
+
output:
|
|
84
|
+
schema:
|
|
85
|
+
response: "$llmResult.response"
|
|
86
|
+
timestamp: "$llmResult.timestamp"
|
|
87
|
+
error: "$llmResult.error"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Agent - Public exports (client-safe)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Schema exports (client-safe)
|
|
6
|
+
export { McpToolInputSchema, McpToolOutputSchema } from './mcp-tool.schema';
|
|
7
|
+
export type { McpToolInput, McpToolOutput } from './mcp-tool.schema';
|
|
8
|
+
|
|
9
|
+
// Type exports (client-safe)
|
|
10
|
+
export type { McpToolHandlerParams, McpToolHandlerResult, McpToolMetadata } from './mcp-tool.types';
|
|
11
|
+
|
|
12
|
+
// Metadata (client-safe)
|
|
13
|
+
export const mcpToolMetadata = {
|
|
14
|
+
id: 'mcp-tool',
|
|
15
|
+
name: 'MCP Tool Agent',
|
|
16
|
+
description: 'Generic agent for calling MCP server tools via SSE transport',
|
|
17
|
+
category: 'integration',
|
|
18
|
+
route: '/agents/mcp-tool',
|
|
19
|
+
} as const;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import 'server-only';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MCP Tool Agent Handler - Server-only execution logic
|
|
5
|
+
* Generic agent for calling MCP server tools via SSE transport
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ExecutionContext } from '../../types/executionContext';
|
|
9
|
+
import type { McpToolHandlerParams, McpToolHandlerResult } from './mcp-tool.types';
|
|
10
|
+
|
|
11
|
+
// MCP imports (lazy loaded to avoid issues if not installed)
|
|
12
|
+
let mcpClient: any = null;
|
|
13
|
+
let mcpSSETransport: any = null;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Execute MCP tool invocation
|
|
17
|
+
*/
|
|
18
|
+
export async function executeMcpToolHandler(
|
|
19
|
+
params: McpToolHandlerParams,
|
|
20
|
+
_props: Record<string, string>,
|
|
21
|
+
context: ExecutionContext
|
|
22
|
+
): Promise<McpToolHandlerResult> {
|
|
23
|
+
const serverUrl = params.server_url;
|
|
24
|
+
const toolName = params.tool_name;
|
|
25
|
+
const toolArguments = params.tool_arguments || {};
|
|
26
|
+
|
|
27
|
+
if (!serverUrl) {
|
|
28
|
+
throw new Error('Missing required MCP input: server_url');
|
|
29
|
+
}
|
|
30
|
+
if (!toolName) {
|
|
31
|
+
throw new Error('Missing required MCP input: tool_name');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
context.log(`[MCP Tool] Connecting to ${serverUrl}...`);
|
|
35
|
+
context.log(`[MCP Tool] Tool: ${toolName}`);
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
// Lazy load MCP SDK
|
|
39
|
+
if (!mcpClient) {
|
|
40
|
+
const { Client } = await import('@modelcontextprotocol/sdk/client/index.js');
|
|
41
|
+
const { SSEClientTransport } = await import('@modelcontextprotocol/sdk/client/sse.js');
|
|
42
|
+
mcpClient = Client;
|
|
43
|
+
mcpSSETransport = SSEClientTransport;
|
|
44
|
+
|
|
45
|
+
// Setup EventSource for Node.js
|
|
46
|
+
const eventsourceModule = await import('eventsource');
|
|
47
|
+
const EventSourceClass = eventsourceModule.default || eventsourceModule;
|
|
48
|
+
if (!(global as any).EventSource) {
|
|
49
|
+
(global as any).EventSource = EventSourceClass;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const transport = new mcpSSETransport(new URL(serverUrl));
|
|
54
|
+
const client = new mcpClient(
|
|
55
|
+
{ name: 'beddel-mcp-client', version: '1.0.0' },
|
|
56
|
+
{ capabilities: {} }
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
await client.connect(transport);
|
|
60
|
+
context.log('[MCP Tool] Connected!');
|
|
61
|
+
|
|
62
|
+
// List available tools
|
|
63
|
+
const tools = await client.listTools();
|
|
64
|
+
const availableToolNames = tools.tools.map((t: any) => t.name);
|
|
65
|
+
context.log(`[MCP Tool] Available tools: ${availableToolNames.join(', ')}`);
|
|
66
|
+
|
|
67
|
+
// Handle list_tools special case
|
|
68
|
+
if (toolName === 'list_tools') {
|
|
69
|
+
await client.close();
|
|
70
|
+
return {
|
|
71
|
+
success: true,
|
|
72
|
+
data: JSON.stringify(tools.tools),
|
|
73
|
+
tool_names: availableToolNames,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Validate tool exists
|
|
78
|
+
if (!availableToolNames.includes(toolName)) {
|
|
79
|
+
await client.close();
|
|
80
|
+
return {
|
|
81
|
+
success: false,
|
|
82
|
+
error: `Tool '${toolName}' not found. Available tools: ${availableToolNames.join(', ')}`,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Call the tool with timeout
|
|
87
|
+
const timeoutPromise = new Promise((_, reject) =>
|
|
88
|
+
setTimeout(() => reject(new Error('MCP Tool Timeout (30s)')), 30000)
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const callPromise = client.callTool({
|
|
92
|
+
name: toolName,
|
|
93
|
+
arguments: toolArguments,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const callResult: any = await Promise.race([callPromise, timeoutPromise]);
|
|
97
|
+
await client.close();
|
|
98
|
+
|
|
99
|
+
// Parse result content
|
|
100
|
+
const textContent = callResult.content
|
|
101
|
+
.filter((c: any) => c.type === 'text')
|
|
102
|
+
.map((c: any) => c.text)
|
|
103
|
+
.join('\n') || 'No text content returned';
|
|
104
|
+
|
|
105
|
+
return { success: true, data: textContent };
|
|
106
|
+
|
|
107
|
+
} catch (error: unknown) {
|
|
108
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
109
|
+
context.log(`[MCP Tool] Error: ${message}`);
|
|
110
|
+
return { success: false, error: message };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Agent Schema - Zod validation schemas
|
|
3
|
+
* Safe for both client and server
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
export const McpToolInputSchema = z.object({
|
|
9
|
+
server_url: z.string().url(),
|
|
10
|
+
tool_name: z.string().min(1),
|
|
11
|
+
tool_arguments: z.record(z.string(), z.unknown()).optional(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const McpToolOutputSchema = z.object({
|
|
15
|
+
success: z.boolean(),
|
|
16
|
+
data: z.string().optional(),
|
|
17
|
+
tool_names: z.array(z.string()).optional(),
|
|
18
|
+
error: z.string().optional(),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type McpToolInput = z.infer<typeof McpToolInputSchema>;
|
|
22
|
+
export type McpToolOutput = z.infer<typeof McpToolOutputSchema>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Agent Types - Shared between client and server
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Parameters for MCP tool invocation
|
|
7
|
+
*/
|
|
8
|
+
export interface McpToolHandlerParams {
|
|
9
|
+
server_url: string;
|
|
10
|
+
tool_name: string;
|
|
11
|
+
tool_arguments?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Result from MCP tool invocation
|
|
16
|
+
*/
|
|
17
|
+
export interface McpToolHandlerResult {
|
|
18
|
+
success: boolean;
|
|
19
|
+
data?: string;
|
|
20
|
+
tool_names?: string[];
|
|
21
|
+
error?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* MCP Tool agent metadata
|
|
26
|
+
*/
|
|
27
|
+
export interface McpToolMetadata {
|
|
28
|
+
id: 'mcp-tool';
|
|
29
|
+
name: string;
|
|
30
|
+
description: string;
|
|
31
|
+
category: 'integration';
|
|
32
|
+
route: '/agents/mcp-tool';
|
|
33
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# MCP Tool Agent - Native Builtin Agent for Beddel Runtime
|
|
2
|
+
# Route: /agents/mcp-tool
|
|
3
|
+
# Method: mcp-tool.execute
|
|
4
|
+
|
|
5
|
+
agent:
|
|
6
|
+
id: mcp-tool
|
|
7
|
+
version: 1.0.0
|
|
8
|
+
protocol: beddel-declarative-protocol/v2.0
|
|
9
|
+
|
|
10
|
+
metadata:
|
|
11
|
+
name: "MCP Tool Agent"
|
|
12
|
+
description: "Generic agent for calling MCP server tools via SSE transport"
|
|
13
|
+
category: "integration"
|
|
14
|
+
route: "/agents/mcp-tool"
|
|
15
|
+
|
|
16
|
+
schema:
|
|
17
|
+
input:
|
|
18
|
+
type: "object"
|
|
19
|
+
properties:
|
|
20
|
+
server_url:
|
|
21
|
+
type: "string"
|
|
22
|
+
description: "MCP server SSE endpoint URL"
|
|
23
|
+
tool_name:
|
|
24
|
+
type: "string"
|
|
25
|
+
description: "Name of the MCP tool to invoke (use 'list_tools' to discover available tools)"
|
|
26
|
+
tool_arguments:
|
|
27
|
+
type: "object"
|
|
28
|
+
description: "Arguments to pass to the tool"
|
|
29
|
+
required: ["server_url", "tool_name"]
|
|
30
|
+
|
|
31
|
+
output:
|
|
32
|
+
type: "object"
|
|
33
|
+
properties:
|
|
34
|
+
success:
|
|
35
|
+
type: "boolean"
|
|
36
|
+
data:
|
|
37
|
+
type: "string"
|
|
38
|
+
tool_names:
|
|
39
|
+
type: "array"
|
|
40
|
+
items:
|
|
41
|
+
type: "string"
|
|
42
|
+
error:
|
|
43
|
+
type: "string"
|
|
44
|
+
required: ["success"]
|
|
45
|
+
|
|
46
|
+
logic:
|
|
47
|
+
workflow:
|
|
48
|
+
- name: "call-mcp-tool"
|
|
49
|
+
type: "mcp-tool"
|
|
50
|
+
action:
|
|
51
|
+
server_url: "$input.server_url"
|
|
52
|
+
tool_name: "$input.tool_name"
|
|
53
|
+
tool_arguments: "$input.tool_arguments"
|
|
54
|
+
result: "mcpResult"
|
|
55
|
+
|
|
56
|
+
- name: "deliver-response"
|
|
57
|
+
type: "output-generator"
|
|
58
|
+
action:
|
|
59
|
+
type: "generate"
|
|
60
|
+
output:
|
|
61
|
+
success: "$mcpResult.success"
|
|
62
|
+
data: "$mcpResult.data"
|
|
63
|
+
tool_names: "$mcpResult.toolNames"
|
|
64
|
+
error: "$mcpResult.error"
|
|
65
|
+
|
|
66
|
+
output:
|
|
67
|
+
schema:
|
|
68
|
+
success: "$mcpResult.success"
|
|
69
|
+
data: "$mcpResult.data"
|
|
70
|
+
tool_names: "$mcpResult.toolNames"
|
|
71
|
+
error: "$mcpResult.error"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RAG Agent - Public exports (client-safe)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Schema exports (client-safe)
|
|
6
|
+
export { RagInputSchema, RagOutputSchema } from './rag.schema';
|
|
7
|
+
export type { RagInput, RagOutput } from './rag.schema';
|
|
8
|
+
|
|
9
|
+
// Type exports (client-safe)
|
|
10
|
+
export type { RagHandlerParams, RagHandlerResult, ConversationMessage, RagMetadata } from './rag.types';
|
|
11
|
+
|
|
12
|
+
// Metadata (client-safe)
|
|
13
|
+
export const ragMetadata = {
|
|
14
|
+
id: 'rag',
|
|
15
|
+
name: 'RAG Intelligence Agent',
|
|
16
|
+
description: 'Generates natural language answers based on provided context using Gemini',
|
|
17
|
+
category: 'intelligence',
|
|
18
|
+
route: '/agents/rag',
|
|
19
|
+
tags: ['rag', 'gemini', 'qa', 'generation'],
|
|
20
|
+
} as const;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import 'server-only';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* RAG Agent Handler - Server-only execution logic
|
|
5
|
+
* Generates natural language answers based on provided document context using LLM
|
|
6
|
+
*
|
|
7
|
+
* Note: RAG = Retrieval-Augmented Generation
|
|
8
|
+
* This agent ALWAYS requires document context. For direct LLM chat without
|
|
9
|
+
* documents, use the LLM agent instead.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { generateText } from 'ai';
|
|
13
|
+
import { LLMProviderFactory, extractProviderConfig } from '../../runtime/llmProviderFactory';
|
|
14
|
+
import type { ExecutionContext } from '../../types/executionContext';
|
|
15
|
+
import type { RagHandlerParams, RagHandlerResult, ConversationMessage } from './rag.types';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Build prompt for RAG mode (with documents)
|
|
19
|
+
*/
|
|
20
|
+
function buildRagPrompt(
|
|
21
|
+
query: string,
|
|
22
|
+
ragContext: string,
|
|
23
|
+
history?: ConversationMessage[]
|
|
24
|
+
): string {
|
|
25
|
+
const conversationContext = history?.length
|
|
26
|
+
? `CONVERSATION HISTORY:\n${history.map((m) => `${m.role.toUpperCase()}: ${m.content}`).join('\n')}\n\n`
|
|
27
|
+
: '';
|
|
28
|
+
|
|
29
|
+
return `You are a helpful and expert assistant for the Beddel Protocol.
|
|
30
|
+
|
|
31
|
+
${conversationContext}CONTEXT INFORMATION:
|
|
32
|
+
${ragContext}
|
|
33
|
+
|
|
34
|
+
USER QUESTION:
|
|
35
|
+
${query}
|
|
36
|
+
|
|
37
|
+
INSTRUCTIONS:
|
|
38
|
+
1. Answer the user's question based on the CONTEXT INFORMATION provided above.
|
|
39
|
+
2. Consider the CONVERSATION HISTORY for context continuity if available.
|
|
40
|
+
3. If the context does not contain the answer, politely state that you don't have enough information in the documentation to answer.
|
|
41
|
+
4. Be concise but comprehensive.
|
|
42
|
+
|
|
43
|
+
ANSWER:`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Execute RAG answer generation
|
|
48
|
+
* Requires document context - for direct LLM chat, use the LLM agent
|
|
49
|
+
*/
|
|
50
|
+
export async function executeRagHandler(
|
|
51
|
+
params: RagHandlerParams,
|
|
52
|
+
props: Record<string, string>,
|
|
53
|
+
context: ExecutionContext
|
|
54
|
+
): Promise<RagHandlerResult> {
|
|
55
|
+
const providerConfig = extractProviderConfig(props, 'google');
|
|
56
|
+
const model = LLMProviderFactory.createLanguageModel(providerConfig);
|
|
57
|
+
|
|
58
|
+
const { query, history } = params;
|
|
59
|
+
const ragContext = params.context || params.documents;
|
|
60
|
+
|
|
61
|
+
if (!query) {
|
|
62
|
+
throw new Error('Missing required RAG input: query');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!ragContext) {
|
|
66
|
+
throw new Error('Missing required RAG input: context or documents. For direct LLM chat without documents, use the LLM agent instead.');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const prompt = buildRagPrompt(query, ragContext, history);
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
context.log(`[RAG] Generating answer for: "${query.substring(0, 50)}..."`);
|
|
73
|
+
|
|
74
|
+
const { text } = await generateText({
|
|
75
|
+
model,
|
|
76
|
+
prompt,
|
|
77
|
+
temperature: 0.3,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
response: text,
|
|
82
|
+
answer: text,
|
|
83
|
+
timestamp: new Date().toISOString(),
|
|
84
|
+
};
|
|
85
|
+
} catch (error: unknown) {
|
|
86
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
87
|
+
context.log(`[RAG] Error: ${message}`);
|
|
88
|
+
return {
|
|
89
|
+
response: '',
|
|
90
|
+
answer: '',
|
|
91
|
+
timestamp: new Date().toISOString(),
|
|
92
|
+
error: message,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RAG Agent Schema - Zod validation schemas
|
|
3
|
+
* Safe for both client and server
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
export const RagInputSchema = z.object({
|
|
9
|
+
query: z.string().min(1),
|
|
10
|
+
context: z.string().optional(),
|
|
11
|
+
documents: z.string().optional(),
|
|
12
|
+
history: z.array(z.object({
|
|
13
|
+
role: z.enum(['user', 'assistant', 'system']),
|
|
14
|
+
content: z.string(),
|
|
15
|
+
})).optional(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const RagOutputSchema = z.object({
|
|
19
|
+
response: z.string(),
|
|
20
|
+
answer: z.string().optional(),
|
|
21
|
+
timestamp: z.string().optional(),
|
|
22
|
+
error: z.string().optional(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export type RagInput = z.infer<typeof RagInputSchema>;
|
|
26
|
+
export type RagOutput = z.infer<typeof RagOutputSchema>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RAG Agent Types - Shared between client and server
|
|
3
|
+
* RAG = Retrieval-Augmented Generation (always requires document context)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Conversation message
|
|
8
|
+
*/
|
|
9
|
+
export interface ConversationMessage {
|
|
10
|
+
role: 'user' | 'assistant' | 'system';
|
|
11
|
+
content: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Parameters for RAG answer generation
|
|
16
|
+
* Note: context or documents is REQUIRED - RAG always needs document context
|
|
17
|
+
*/
|
|
18
|
+
export interface RagHandlerParams {
|
|
19
|
+
query: string;
|
|
20
|
+
context?: string;
|
|
21
|
+
documents?: string;
|
|
22
|
+
history?: ConversationMessage[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Result from RAG answer generation
|
|
27
|
+
*/
|
|
28
|
+
export interface RagHandlerResult {
|
|
29
|
+
response: string;
|
|
30
|
+
answer: string;
|
|
31
|
+
timestamp: string;
|
|
32
|
+
error?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* RAG agent metadata
|
|
37
|
+
*/
|
|
38
|
+
export interface RagMetadata {
|
|
39
|
+
id: 'rag';
|
|
40
|
+
name: string;
|
|
41
|
+
description: string;
|
|
42
|
+
category: 'intelligence';
|
|
43
|
+
route: '/agents/rag';
|
|
44
|
+
tags: string[];
|
|
45
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# RAG Agent - Native Builtin Agent for Beddel Runtime
|
|
2
|
+
# Route: /agents/rag
|
|
3
|
+
# Method: rag.execute
|
|
4
|
+
|
|
5
|
+
agent:
|
|
6
|
+
id: rag
|
|
7
|
+
version: 1.0.0
|
|
8
|
+
protocol: beddel-declarative-protocol/v2.0
|
|
9
|
+
|
|
10
|
+
metadata:
|
|
11
|
+
name: "RAG Intelligence Agent"
|
|
12
|
+
description: "Generates natural language answers based on provided context using Gemini"
|
|
13
|
+
category: "intelligence"
|
|
14
|
+
route: "/agents/rag"
|
|
15
|
+
tags:
|
|
16
|
+
- "rag"
|
|
17
|
+
- "gemini"
|
|
18
|
+
- "qa"
|
|
19
|
+
- "generation"
|
|
20
|
+
|
|
21
|
+
schema:
|
|
22
|
+
input:
|
|
23
|
+
type: "object"
|
|
24
|
+
properties:
|
|
25
|
+
query:
|
|
26
|
+
type: "string"
|
|
27
|
+
description: "User question to answer"
|
|
28
|
+
context:
|
|
29
|
+
type: "string"
|
|
30
|
+
description: "Retrieved documentation or context for answering"
|
|
31
|
+
documents:
|
|
32
|
+
type: "string"
|
|
33
|
+
description: "Alternative to context - retrieved documents"
|
|
34
|
+
history:
|
|
35
|
+
type: "array"
|
|
36
|
+
items:
|
|
37
|
+
type: "object"
|
|
38
|
+
properties:
|
|
39
|
+
role:
|
|
40
|
+
type: "string"
|
|
41
|
+
enum: ["user", "assistant", "system"]
|
|
42
|
+
content:
|
|
43
|
+
type: "string"
|
|
44
|
+
description: "Conversation history for context continuity"
|
|
45
|
+
required: ["query"]
|
|
46
|
+
|
|
47
|
+
output:
|
|
48
|
+
type: "object"
|
|
49
|
+
properties:
|
|
50
|
+
response:
|
|
51
|
+
type: "string"
|
|
52
|
+
description: "Generated answer"
|
|
53
|
+
answer:
|
|
54
|
+
type: "string"
|
|
55
|
+
description: "Alias for response"
|
|
56
|
+
timestamp:
|
|
57
|
+
type: "string"
|
|
58
|
+
description: "ISO timestamp of generation"
|
|
59
|
+
error:
|
|
60
|
+
type: "string"
|
|
61
|
+
required: ["response"]
|
|
62
|
+
|
|
63
|
+
logic:
|
|
64
|
+
workflow:
|
|
65
|
+
- name: "generate-answer"
|
|
66
|
+
type: "rag"
|
|
67
|
+
action:
|
|
68
|
+
query: "$input.query"
|
|
69
|
+
context: "$input.context"
|
|
70
|
+
documents: "$input.documents"
|
|
71
|
+
history: "$input.history"
|
|
72
|
+
result: "ragResult"
|
|
73
|
+
|
|
74
|
+
- name: "deliver-response"
|
|
75
|
+
type: "output-generator"
|
|
76
|
+
action:
|
|
77
|
+
type: "generate"
|
|
78
|
+
output:
|
|
79
|
+
response: "$ragResult.response"
|
|
80
|
+
answer: "$ragResult.answer"
|
|
81
|
+
timestamp: "$ragResult.timestamp"
|
|
82
|
+
error: "$ragResult.error"
|
|
83
|
+
|
|
84
|
+
output:
|
|
85
|
+
schema:
|
|
86
|
+
response: "$ragResult.response"
|
|
87
|
+
answer: "$ragResult.answer"
|
|
88
|
+
timestamp: "$ragResult.timestamp"
|
|
89
|
+
error: "$ragResult.error"
|