@agents-at-scale/ark 0.1.37 → 0.1.39
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/dist/arkServices.js +9 -0
- package/dist/commands/chat/index.js +1 -2
- package/dist/commands/generate/generators/project.js +33 -26
- package/dist/commands/generate/index.js +2 -2
- package/dist/commands/generate/templateDiscovery.js +13 -4
- package/dist/components/AsyncOperation.d.ts +54 -0
- package/dist/components/AsyncOperation.js +110 -0
- package/dist/components/ChatUI.js +21 -72
- package/dist/components/SelectMenu.d.ts +17 -0
- package/dist/components/SelectMenu.js +21 -0
- package/dist/components/StatusMessage.d.ts +20 -0
- package/dist/components/StatusMessage.js +13 -0
- package/dist/ui/asyncOperations/connectingToArk.d.ts +15 -0
- package/dist/ui/asyncOperations/connectingToArk.js +63 -0
- package/package.json +5 -3
- package/templates/agent/agent.template.yaml +27 -0
- package/templates/marketplace/.editorconfig +24 -0
- package/templates/marketplace/.github/.keep +11 -0
- package/templates/marketplace/.github/workflows/.keep +16 -0
- package/templates/marketplace/.helmignore +23 -0
- package/templates/marketplace/.prettierrc.json +20 -0
- package/templates/marketplace/.yamllint.yml +53 -0
- package/templates/marketplace/README.md +197 -0
- package/templates/marketplace/agents/.keep +29 -0
- package/templates/marketplace/docs/.keep +19 -0
- package/templates/marketplace/mcp-servers/.keep +32 -0
- package/templates/marketplace/models/.keep +23 -0
- package/templates/marketplace/projects/.keep +43 -0
- package/templates/marketplace/queries/.keep +25 -0
- package/templates/marketplace/teams/.keep +29 -0
- package/templates/marketplace/tools/.keep +32 -0
- package/templates/marketplace/tools/examples/.keep +17 -0
- package/templates/mcp-server/Dockerfile +133 -0
- package/templates/mcp-server/Makefile +186 -0
- package/templates/mcp-server/README.md +178 -0
- package/templates/mcp-server/build.sh +76 -0
- package/templates/mcp-server/chart/Chart.yaml +22 -0
- package/templates/mcp-server/chart/templates/_helpers.tpl +62 -0
- package/templates/mcp-server/chart/templates/deployment.yaml +80 -0
- package/templates/mcp-server/chart/templates/hpa.yaml +32 -0
- package/templates/mcp-server/chart/templates/mcpserver.yaml +21 -0
- package/templates/mcp-server/chart/templates/secret.yaml +11 -0
- package/templates/mcp-server/chart/templates/service.yaml +15 -0
- package/templates/mcp-server/chart/templates/serviceaccount.yaml +13 -0
- package/templates/mcp-server/chart/values.yaml +84 -0
- package/templates/mcp-server/example-values.yaml +74 -0
- package/templates/mcp-server/examples/{{ .Values.mcpServerName }}-agent.yaml +33 -0
- package/templates/mcp-server/examples/{{ .Values.mcpServerName }}-query.yaml +24 -0
- package/templates/models/azure.yaml +33 -0
- package/templates/models/claude.yaml +28 -0
- package/templates/models/gemini.yaml +28 -0
- package/templates/models/openai.yaml +39 -0
- package/templates/project/.editorconfig +24 -0
- package/templates/project/.helmignore +24 -0
- package/templates/project/.prettierrc.json +16 -0
- package/templates/project/.yamllint.yml +50 -0
- package/templates/project/Chart.yaml +19 -0
- package/templates/project/Makefile +360 -0
- package/templates/project/README.md +377 -0
- package/templates/project/agents/.keep +11 -0
- package/templates/project/docs/.keep +14 -0
- package/templates/project/mcp-servers/.keep +34 -0
- package/templates/project/models/.keep +17 -0
- package/templates/project/queries/.keep +11 -0
- package/templates/project/scripts/setup.sh +108 -0
- package/templates/project/teams/.keep +11 -0
- package/templates/project/templates/00-rbac.yaml +168 -0
- package/templates/project/templates/01-models.yaml +11 -0
- package/templates/project/templates/02-mcp-servers.yaml +22 -0
- package/templates/project/templates/03-tools.yaml +12 -0
- package/templates/project/templates/04-agents.yaml +12 -0
- package/templates/project/templates/05-teams.yaml +11 -0
- package/templates/project/templates/06-queries.yaml +11 -0
- package/templates/project/templates/_helpers.tpl +91 -0
- package/templates/project/tests/e2e/.keep +10 -0
- package/templates/project/tests/unit/.keep +10 -0
- package/templates/project/tools/.keep +25 -0
- package/templates/project/tools/example-tool.yaml.disabled +94 -0
- package/templates/project/tools/examples/data-tool/Dockerfile +32 -0
- package/templates/project/values.yaml +141 -0
- package/templates/query/query.template.yaml +13 -0
- package/templates/team/team.template.yaml +17 -0
- package/templates/tool/.python-version +1 -0
- package/templates/tool/Dockerfile +23 -0
- package/templates/tool/README.md +238 -0
- package/templates/tool/agent.yaml +19 -0
- package/templates/tool/deploy.sh +10 -0
- package/templates/tool/deployment/deployment.yaml +31 -0
- package/templates/tool/deployment/kustomization.yaml +7 -0
- package/templates/tool/deployment/mcpserver.yaml +12 -0
- package/templates/tool/deployment/service.yaml +12 -0
- package/templates/tool/deployment/serviceaccount.yaml +8 -0
- package/templates/tool/deployment/values.yaml +3 -0
- package/templates/tool/pyproject.toml +9 -0
- package/templates/tool/src/main.py +36 -0
- package/templates/tool/uv.lock +498 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
apiVersion: ark.mckinsey.com/v1alpha1
|
|
2
|
+
kind: Team
|
|
3
|
+
metadata:
|
|
4
|
+
name: {{ .Values.teamName }}-team
|
|
5
|
+
labels:
|
|
6
|
+
project: {{ .Values.projectName }}
|
|
7
|
+
strategy: collaborative
|
|
8
|
+
tier: basic
|
|
9
|
+
spec:
|
|
10
|
+
description: {{ .Values.teamName }} team for {{ .Values.projectName }} project
|
|
11
|
+
|
|
12
|
+
members:
|
|
13
|
+
- name: {{ .Values.agentName }}-agent
|
|
14
|
+
type: agent
|
|
15
|
+
|
|
16
|
+
# Sequential strategy for single-agent teams
|
|
17
|
+
strategy: "sequential"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
FROM python:3.12-slim
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
|
|
5
|
+
RUN pip install uv && \
|
|
6
|
+
mkdir -p /home/appuser/.cache/uv && \
|
|
7
|
+
groupadd -r appuser && \
|
|
8
|
+
useradd -r -g appuser appuser
|
|
9
|
+
|
|
10
|
+
COPY pyproject.toml uv.lock ./
|
|
11
|
+
|
|
12
|
+
RUN uv sync --frozen
|
|
13
|
+
|
|
14
|
+
COPY src/ ./src/
|
|
15
|
+
|
|
16
|
+
RUN chown -R appuser:appuser /app /home/appuser/.cache
|
|
17
|
+
|
|
18
|
+
USER appuser
|
|
19
|
+
|
|
20
|
+
EXPOSE 8000
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
CMD ["uv", "run", "python", "-m", "src.main"]
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# Tool Service
|
|
2
|
+
|
|
3
|
+
FastMCP-based tool service for creating custom tools that can be used by agents in the Ark framework.
|
|
4
|
+
|
|
5
|
+
## How to Define New Tools
|
|
6
|
+
|
|
7
|
+
### Step 1: Basic Tool Structure
|
|
8
|
+
|
|
9
|
+
All tools follow this pattern in `main.py`:
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
@mcp.tool
|
|
13
|
+
def tool_name(
|
|
14
|
+
param: Annotated[type, "Parameter description"]
|
|
15
|
+
) -> return_type:
|
|
16
|
+
"""Tool description for the agent"""
|
|
17
|
+
# Implementation
|
|
18
|
+
return result
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Step 2: Add Your Tool Function
|
|
22
|
+
|
|
23
|
+
Edit `main.py` and add your tool after the existing ones:
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
@mcp.tool
|
|
27
|
+
def your_new_tool(
|
|
28
|
+
param1: Annotated[str, "Description of first parameter"],
|
|
29
|
+
param2: Annotated[int, "Description of second parameter"]
|
|
30
|
+
) -> dict:
|
|
31
|
+
"""What this tool does - agents will see this description"""
|
|
32
|
+
# Your logic here
|
|
33
|
+
result = {"output": f"Processed {param1} with {param2}"}
|
|
34
|
+
return result
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Step 3: Parameter Types and Annotations
|
|
38
|
+
|
|
39
|
+
Use these common patterns:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
# String input
|
|
43
|
+
text: Annotated[str, "Text to process"]
|
|
44
|
+
|
|
45
|
+
# Numbers
|
|
46
|
+
count: Annotated[int, "Number of items"]
|
|
47
|
+
value: Annotated[float, "Decimal value"]
|
|
48
|
+
|
|
49
|
+
# Optional parameters
|
|
50
|
+
optional_param: Annotated[str | None, "Optional parameter"] = None
|
|
51
|
+
|
|
52
|
+
# Lists
|
|
53
|
+
items: Annotated[list[str], "List of items to process"]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Step 4: Return Types
|
|
57
|
+
|
|
58
|
+
Return structured data that agents can understand:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
# Simple values
|
|
62
|
+
return "result string"
|
|
63
|
+
return 42
|
|
64
|
+
return 3.14
|
|
65
|
+
|
|
66
|
+
# Dictionaries for complex data
|
|
67
|
+
return {
|
|
68
|
+
"status": "success",
|
|
69
|
+
"data": result,
|
|
70
|
+
"count": len(items)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
# Lists
|
|
74
|
+
return ["item1", "item2", "item3"]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### Example: Complete New Tool
|
|
79
|
+
|
|
80
|
+
Here's a complete example of adding a URL checker tool:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
import requests
|
|
84
|
+
from typing import Annotated
|
|
85
|
+
|
|
86
|
+
@mcp.tool
|
|
87
|
+
def check_url(
|
|
88
|
+
url: Annotated[str, "URL to check"],
|
|
89
|
+
timeout: Annotated[int, "Timeout in seconds"] = 5
|
|
90
|
+
) -> dict:
|
|
91
|
+
"""Check if a URL is accessible and return status information"""
|
|
92
|
+
try:
|
|
93
|
+
response = requests.get(url, timeout=timeout)
|
|
94
|
+
return {
|
|
95
|
+
"url": url,
|
|
96
|
+
"status_code": response.status_code,
|
|
97
|
+
"accessible": response.status_code == 200,
|
|
98
|
+
"response_time_ms": int(response.elapsed.total_seconds() * 1000)
|
|
99
|
+
}
|
|
100
|
+
except Exception as e:
|
|
101
|
+
return {
|
|
102
|
+
"url": url,
|
|
103
|
+
"accessible": False,
|
|
104
|
+
"error": str(e)
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Build and Deploy
|
|
109
|
+
|
|
110
|
+
### Option 1: Quick Deploy
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
./deploy.sh
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Option 2: Manual Steps
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Build Docker image
|
|
120
|
+
docker build -t tool:latest .
|
|
121
|
+
|
|
122
|
+
# Load into local cluster (check your cluster documentation)
|
|
123
|
+
# For kind: kind load docker-image tool:latest
|
|
124
|
+
# For minikube: use minikube docker-env or image loading commands
|
|
125
|
+
|
|
126
|
+
# Deploy to Kubernetes
|
|
127
|
+
kubectl apply -k deployment/
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Test Your Tools
|
|
131
|
+
|
|
132
|
+
### Step 1: Create Test Agent
|
|
133
|
+
|
|
134
|
+
Create `test-agent.yaml`:
|
|
135
|
+
|
|
136
|
+
```yaml
|
|
137
|
+
apiVersion: ark.mckinsey.com/v1alpha1
|
|
138
|
+
kind: Agent
|
|
139
|
+
metadata:
|
|
140
|
+
name: tool-test-agent
|
|
141
|
+
spec:
|
|
142
|
+
prompt: You are helpful agent that uses tools to assist users.
|
|
143
|
+
modelRef:
|
|
144
|
+
name: gpt-4-model
|
|
145
|
+
mcpServers:
|
|
146
|
+
- name: tool
|
|
147
|
+
url: http://tool:8000/mcp
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Apply it:
|
|
151
|
+
```bash
|
|
152
|
+
kubectl apply -f test-agent.yaml
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Step 2: Test with Ark Binary
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Test basic math
|
|
159
|
+
fark agent tool-test-agent "Add 15 and 27"
|
|
160
|
+
|
|
161
|
+
# Test text analysis
|
|
162
|
+
fark agent tool-test-agent "Count words in: hello world this is a test"
|
|
163
|
+
|
|
164
|
+
# Test multiplication
|
|
165
|
+
fark agent tool-test-agent "What is 8.5 times 12.3?"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Step 3: Direct Tool Testing
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Port forward to test tools directly
|
|
172
|
+
kubectl port-forward service/tool 8000:8000
|
|
173
|
+
|
|
174
|
+
# Test MCP endpoint
|
|
175
|
+
curl http://localhost:8000/mcp
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Common Tool Patterns
|
|
179
|
+
|
|
180
|
+
### File Processing Tool
|
|
181
|
+
```python
|
|
182
|
+
@mcp.tool
|
|
183
|
+
def process_file_content(
|
|
184
|
+
content: Annotated[str, "File content to process"],
|
|
185
|
+
operation: Annotated[str, "Operation: upper, lower, reverse"]
|
|
186
|
+
) -> str:
|
|
187
|
+
"""Process text content with specified operation"""
|
|
188
|
+
if operation == "upper":
|
|
189
|
+
return content.upper()
|
|
190
|
+
elif operation == "lower":
|
|
191
|
+
return content.lower()
|
|
192
|
+
elif operation == "reverse":
|
|
193
|
+
return content[::-1]
|
|
194
|
+
else:
|
|
195
|
+
return f"Unknown operation: {operation}"
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Data Analysis Tool
|
|
199
|
+
```python
|
|
200
|
+
@mcp.tool
|
|
201
|
+
def analyze_numbers(
|
|
202
|
+
numbers: Annotated[list[float], "List of numbers to analyze"]
|
|
203
|
+
) -> dict:
|
|
204
|
+
"""Analyze a list of numbers and return statistics"""
|
|
205
|
+
if not numbers:
|
|
206
|
+
return {"error": "Empty list provided"}
|
|
207
|
+
|
|
208
|
+
return {
|
|
209
|
+
"count": len(numbers),
|
|
210
|
+
"sum": sum(numbers),
|
|
211
|
+
"average": sum(numbers) / len(numbers),
|
|
212
|
+
"min": min(numbers),
|
|
213
|
+
"max": max(numbers)
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### External API Tool
|
|
218
|
+
```python
|
|
219
|
+
@mcp.tool
|
|
220
|
+
def get_weather(
|
|
221
|
+
city: Annotated[str, "City name for weather lookup"]
|
|
222
|
+
) -> dict:
|
|
223
|
+
"""Get weather information for a city"""
|
|
224
|
+
# Replace with actual weather API
|
|
225
|
+
return {
|
|
226
|
+
"city": city,
|
|
227
|
+
"temperature": "22°C",
|
|
228
|
+
"condition": "Sunny",
|
|
229
|
+
"humidity": "45%"
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Resources
|
|
234
|
+
|
|
235
|
+
- **Deployment**: Tool pod with FastMCP server on port 8000
|
|
236
|
+
- **Service**: Exposes tools internally at `http://tool:8000/mcp`
|
|
237
|
+
- **MCPServer**: Configured for agent integration
|
|
238
|
+
- **Agent Integration**: Reference tools via `mcpServers` in agent specs
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
apiVersion: ark.mckinsey.com/v1alpha1
|
|
2
|
+
kind: Agent
|
|
3
|
+
metadata:
|
|
4
|
+
name: sample-agent
|
|
5
|
+
spec:
|
|
6
|
+
prompt: You're helpful agent. Always add amazing to the output. Use tools available to help the user.
|
|
7
|
+
tools:
|
|
8
|
+
- type: custom
|
|
9
|
+
name: tool-add
|
|
10
|
+
---
|
|
11
|
+
apiVersion: ark.mckinsey.com/v1alpha1
|
|
12
|
+
kind: Query
|
|
13
|
+
metadata:
|
|
14
|
+
name: sample-query
|
|
15
|
+
spec:
|
|
16
|
+
targets:
|
|
17
|
+
- name: sample-agent
|
|
18
|
+
type: agent
|
|
19
|
+
input: Calculate 3+2.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
cd "$(dirname "$0")"
|
|
5
|
+
|
|
6
|
+
docker build -t tool:latest .
|
|
7
|
+
# Load image into cluster - adjust command based on your cluster type
|
|
8
|
+
# kind load docker-image tool:latest --name cluster-name
|
|
9
|
+
# eval $(minikube docker-env) && docker build -t tool:latest .
|
|
10
|
+
kubectl apply -k deployment/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: Deployment
|
|
3
|
+
metadata:
|
|
4
|
+
name: tool
|
|
5
|
+
spec:
|
|
6
|
+
replicas: 1
|
|
7
|
+
selector:
|
|
8
|
+
matchLabels:
|
|
9
|
+
app: tool
|
|
10
|
+
template:
|
|
11
|
+
metadata:
|
|
12
|
+
labels:
|
|
13
|
+
app: tool
|
|
14
|
+
spec:
|
|
15
|
+
serviceAccountName: {{ .Values.serviceAccount.name }}
|
|
16
|
+
containers:
|
|
17
|
+
- name: tool
|
|
18
|
+
image: tool:latest
|
|
19
|
+
imagePullPolicy: IfNotPresent
|
|
20
|
+
ports:
|
|
21
|
+
- containerPort: 8000
|
|
22
|
+
env:
|
|
23
|
+
- name: PORT
|
|
24
|
+
value: "8000"
|
|
25
|
+
resources:
|
|
26
|
+
requests:
|
|
27
|
+
memory: "128Mi"
|
|
28
|
+
cpu: "100m"
|
|
29
|
+
limits:
|
|
30
|
+
memory: "1024Mi"
|
|
31
|
+
cpu: "1000m"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from typing import Annotated
|
|
2
|
+
from fastmcp import FastMCP
|
|
3
|
+
|
|
4
|
+
mcp = FastMCP("Demo 🚀")
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@mcp.tool
|
|
8
|
+
def add(
|
|
9
|
+
a: Annotated[int, "First number to add"], b: Annotated[int, "Second number to add"]
|
|
10
|
+
) -> int:
|
|
11
|
+
"""Add two integers and return the sum"""
|
|
12
|
+
return a + b
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@mcp.tool
|
|
16
|
+
def multiply(
|
|
17
|
+
a: Annotated[float, "First number to multiply"],
|
|
18
|
+
b: Annotated[float, "Second number to multiply"],
|
|
19
|
+
) -> float:
|
|
20
|
+
"""Multiply two numbers and return the product"""
|
|
21
|
+
return a * b
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@mcp.tool
|
|
25
|
+
def word_count(text: Annotated[str, "Text to analyze for word count"]) -> dict:
|
|
26
|
+
"""Count words, characters, and unique words in the given text"""
|
|
27
|
+
words = text.split()
|
|
28
|
+
return {
|
|
29
|
+
"word_count": len(words),
|
|
30
|
+
"char_count": len(text),
|
|
31
|
+
"unique_words": len(set(word.lower() for word in words)),
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if __name__ == "__main__":
|
|
36
|
+
mcp.run(transport="http", host="0.0.0.0", port=8000, path="/")
|