You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-21Lines changed: 36 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,7 +139,8 @@ spec:
139
139
apiKeyFrom:
140
140
secretKeyRef:
141
141
name: openai
142
-
key: OPENAI_API_KEY'| kubectl apply -f -
142
+
key: OPENAI_API_KEY
143
+
'| kubectl apply -f -
143
144
```
144
145
145
146
```mermaid
@@ -231,7 +232,8 @@ spec:
231
232
llmRef:
232
233
name: gpt-4o
233
234
system: |
234
-
You are a helpful assistant. Your job is to help the user with their tasks.'| kubectl apply -f -
235
+
You are a helpful assistant. Your job is to help the user with their tasks.
236
+
'| kubectl apply -f -
235
237
```
236
238
237
239
```mermaid
@@ -329,7 +331,8 @@ metadata:
329
331
spec:
330
332
agentRef:
331
333
name: my-assistant
332
-
userMessage: "What is the capital of the moon?"'| kubectl apply -f -
334
+
userMessage: "What is the capital of the moon?"
335
+
'| kubectl apply -f -
333
336
```
334
337
335
338
```mermaid
@@ -525,7 +528,8 @@ metadata:
525
528
spec:
526
529
transport: "stdio"
527
530
command: "uvx"
528
-
args: ["mcp-server-fetch"]'| kubectl apply -f -
531
+
args: ["mcp-server-fetch"]
532
+
'| kubectl apply -f -
529
533
```
530
534
531
535
```bash
@@ -603,7 +607,8 @@ spec:
603
607
system: |
604
608
You are a helpful assistant. Your job is to help the user with their tasks.
605
609
mcpServers:
606
-
- name: fetch'| kubectl apply -f -
610
+
- name: fetch
611
+
'| kubectl apply -f -
607
612
```
608
613
609
614
```mermaid
@@ -645,7 +650,8 @@ metadata:
645
650
spec:
646
651
agentRef:
647
652
name: my-assistant
648
-
userMessage: "what is the data at https://lotrapi.co/api/v1/characters/1? "'| kubectl apply -f -
653
+
userMessage: "what is the data at https://lotrapi.co/api/v1/characters/1? "
654
+
'| kubectl apply -f -
649
655
```
650
656
651
657
You should see some events in the output of
@@ -859,7 +865,8 @@ spec:
859
865
apiKeyFrom:
860
866
secretKeyRef:
861
867
name: anthropic
862
-
key: ANTHROPIC_API_KEY'| kubectl apply -f -
868
+
key: ANTHROPIC_API_KEY
869
+
'| kubectl apply -f -
863
870
```
864
871
865
872
fetch the LLM to verify it was created:
@@ -884,7 +891,8 @@ spec:
884
891
llmRef:
885
892
name: claude-3-5-sonnet
886
893
system: |
887
-
You are a helpful assistant. Your job is to help the user with their tasks.'| kubectl apply -f -
894
+
You are a helpful assistant. Your job is to help the user with their tasks.
895
+
'| kubectl apply -f -
888
896
```
889
897
890
898
```bash
@@ -895,7 +903,8 @@ metadata:
895
903
spec:
896
904
agentRef:
897
905
name: claude
898
-
userMessage: "What is your name and primary directive?"'| kubectl apply -f -
906
+
userMessage: "What is your name and primary directive?"
907
+
'| kubectl apply -f -
899
908
```
900
909
901
910
After a few seconds, running
@@ -917,7 +926,7 @@ We can compose agents together to create more complex behaviors and make longer
917
926
Let's create a web search agent that can use the fetch tool we created in the previous example.
918
927
919
928
```bash
920
-
cat <<EOF | kubectl apply -f -
929
+
echo'
921
930
apiVersion: acp.humanlayer.dev/v1alpha1
922
931
kind: Agent
923
932
metadata:
@@ -929,13 +938,13 @@ spec:
929
938
You are a helpful assistant. Your job is to help the user with their tasks.
930
939
mcpServers:
931
940
- name: fetch
932
-
EOF
941
+
'| kubectl apply -f -
933
942
```
934
943
935
944
next, we can create a router agent that can delegate to the web search agent.
936
945
937
946
```bash
938
-
cat <<EOF | kubectl apply -f -
947
+
echo'
939
948
apiVersion: acp.humanlayer.dev/v1alpha1
940
949
kind: Agent
941
950
metadata:
@@ -947,13 +956,13 @@ spec:
947
956
You are a helpful assistant. Your job is to help the user with their tasks.
948
957
subAgents:
949
958
- name: web-search
950
-
EOF
959
+
'| kubectl apply -f -
951
960
```
952
961
953
962
From here, let's create a task that uses the manager agent.
954
963
955
964
```bash
956
-
cat <<EOF | kubectl apply -f -
965
+
echo'
957
966
apiVersion: acp.humanlayer.dev/v1alpha1
958
967
kind: Task
959
968
metadata:
@@ -962,7 +971,7 @@ spec:
962
971
agentRef:
963
972
name: manager
964
973
userMessage: "what is the data at https://lotrapi.co/api/v1/characters/2?"
965
-
EOF
974
+
'| kubectl apply -f -
966
975
```
967
976
968
977
While this is running, you can run the following a few times to see how the parent agent calls a `delegate` tool which then spawns a new task that uses the `web-fetch` agent
@@ -1065,7 +1074,8 @@ spec:
1065
1074
# When an approvalContactChannel is specified,
1066
1075
# all tools on this MCP server will wait for human approval prior executing.
1067
1076
approvalContactChannel:
1068
-
name: approval-channel'| kubectl apply -f -
1077
+
name: approval-channel
1078
+
'| kubectl apply -f -
1069
1079
```
1070
1080
1071
1081
Be sure you have an agent that references the above `MCPServer` by running `kubectl describe agent` or create a fresh `agent` with:
@@ -1081,7 +1091,8 @@ spec:
1081
1091
system: |
1082
1092
You are a helpful assistant. Your job is to help the user with their tasks.
1083
1093
mcpServers:
1084
-
- name: fetch'| kubectl apply -f -
1094
+
- name: fetch
1095
+
'| kubectl apply -f -
1085
1096
```
1086
1097
1087
1098
The fun part: Create a new task that uses the `fetch` tool to test the human approval workflow.
@@ -1094,7 +1105,8 @@ metadata:
1094
1105
spec:
1095
1106
agentRef:
1096
1107
name: agent-with-fetch
1097
-
userMessage: "Write me a haiku about the character found at https://swapi.dev/api/people/2?"'| kubectl apply -f -
1108
+
userMessage: "Write me a haiku about the character found at https://swapi.dev/api/people/2?"
1109
+
'| kubectl apply -f -
1098
1110
```
1099
1111
1100
1112
Once this hits the tool call, we can check out the tool calls to see the human approval workflow in action:
@@ -1178,7 +1190,8 @@ spec:
1178
1190
email:
1179
1191
address: "$MY_EMAIL"
1180
1192
subject: "Request for Expertise"
1181
-
contextAboutUser: "A human expert that can provide a wide-range answers on a variety of topics"'| kubectl apply -f -
1193
+
contextAboutUser: "A human expert that can provide a wide-range answers on a variety of topics"
1194
+
'| kubectl apply -f -
1182
1195
```
1183
1196
1184
1197
Alright, we're ready for a brand new agent:
@@ -1196,7 +1209,8 @@ spec:
1196
1209
mcpServers:
1197
1210
- name: fetch
1198
1211
humanContactChannels:
1199
-
- name: human-expert'| kubectl apply -f -
1212
+
- name: human-expert
1213
+
'| kubectl apply -f -
1200
1214
```
1201
1215
1202
1216
Note the inclusion of `humanContactChannels` here, which now incorporates the `ContactChannel` we just made. Moving forward, any `Task` calls made against this `Agent` will attempt to make use of a human contact where appropriate. As an example, the following Task, _should_ (remember, "non-deterministic") reach out to our Luke Skywalker expert for more information before wrapping up the final output:
@@ -1209,7 +1223,8 @@ metadata:
1209
1223
spec:
1210
1224
agentRef:
1211
1225
name: agent-with-human-tool
1212
-
userMessage: "Ask an expert what the fastest animal on the planet is."'| kubectl apply -f -
1226
+
userMessage: "Ask an expert what the fastest animal on the planet is."
1227
+
'| kubectl apply -f -
1213
1228
```
1214
1229
1215
1230
Provided, you've setup your `ContactChannel` correctly, you should receive an email requesting your expertise. Feel free to respond when ready and keep an eye on how your `Task` and `ToolCall` statuses changes as the answer is picked up.
0 commit comments