Skip to content

Commit f3096e1

Browse files
authored
Merge branch 'main' into automate-readme
2 parents f774a0d + 56677ee commit f3096e1

File tree

8 files changed

+6285
-31
lines changed

8 files changed

+6285
-31
lines changed

README.md

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ spec:
139139
apiKeyFrom:
140140
secretKeyRef:
141141
name: openai
142-
key: OPENAI_API_KEY' | kubectl apply -f -
142+
key: OPENAI_API_KEY
143+
' | kubectl apply -f -
143144
```
144145

145146
```mermaid
@@ -231,7 +232,8 @@ spec:
231232
llmRef:
232233
name: gpt-4o
233234
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 -
235237
```
236238

237239
```mermaid
@@ -329,7 +331,8 @@ metadata:
329331
spec:
330332
agentRef:
331333
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 -
333336
```
334337

335338
```mermaid
@@ -525,7 +528,8 @@ metadata:
525528
spec:
526529
transport: "stdio"
527530
command: "uvx"
528-
args: ["mcp-server-fetch"]' | kubectl apply -f -
531+
args: ["mcp-server-fetch"]
532+
' | kubectl apply -f -
529533
```
530534

531535
```bash
@@ -603,7 +607,8 @@ spec:
603607
system: |
604608
You are a helpful assistant. Your job is to help the user with their tasks.
605609
mcpServers:
606-
- name: fetch' | kubectl apply -f -
610+
- name: fetch
611+
' | kubectl apply -f -
607612
```
608613

609614
```mermaid
@@ -645,7 +650,8 @@ metadata:
645650
spec:
646651
agentRef:
647652
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 -
649655
```
650656

651657
You should see some events in the output of
@@ -859,7 +865,8 @@ spec:
859865
apiKeyFrom:
860866
secretKeyRef:
861867
name: anthropic
862-
key: ANTHROPIC_API_KEY' | kubectl apply -f -
868+
key: ANTHROPIC_API_KEY
869+
' | kubectl apply -f -
863870
```
864871

865872
fetch the LLM to verify it was created:
@@ -884,7 +891,8 @@ spec:
884891
llmRef:
885892
name: claude-3-5-sonnet
886893
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 -
888896
```
889897

890898
```bash
@@ -895,7 +903,8 @@ metadata:
895903
spec:
896904
agentRef:
897905
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 -
899908
```
900909

901910
After a few seconds, running
@@ -917,7 +926,7 @@ We can compose agents together to create more complex behaviors and make longer
917926
Let's create a web search agent that can use the fetch tool we created in the previous example.
918927

919928
```bash
920-
cat <<EOF | kubectl apply -f -
929+
echo '
921930
apiVersion: acp.humanlayer.dev/v1alpha1
922931
kind: Agent
923932
metadata:
@@ -929,13 +938,13 @@ spec:
929938
You are a helpful assistant. Your job is to help the user with their tasks.
930939
mcpServers:
931940
- name: fetch
932-
EOF
941+
' | kubectl apply -f -
933942
```
934943

935944
next, we can create a router agent that can delegate to the web search agent.
936945

937946
```bash
938-
cat <<EOF | kubectl apply -f -
947+
echo '
939948
apiVersion: acp.humanlayer.dev/v1alpha1
940949
kind: Agent
941950
metadata:
@@ -947,13 +956,13 @@ spec:
947956
You are a helpful assistant. Your job is to help the user with their tasks.
948957
subAgents:
949958
- name: web-search
950-
EOF
959+
' | kubectl apply -f -
951960
```
952961

953962
From here, let's create a task that uses the manager agent.
954963

955964
```bash
956-
cat <<EOF | kubectl apply -f -
965+
echo '
957966
apiVersion: acp.humanlayer.dev/v1alpha1
958967
kind: Task
959968
metadata:
@@ -962,7 +971,7 @@ spec:
962971
agentRef:
963972
name: manager
964973
userMessage: "what is the data at https://lotrapi.co/api/v1/characters/2?"
965-
EOF
974+
' | kubectl apply -f -
966975
```
967976

968977
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:
10651074
# When an approvalContactChannel is specified,
10661075
# all tools on this MCP server will wait for human approval prior executing.
10671076
approvalContactChannel:
1068-
name: approval-channel' | kubectl apply -f -
1077+
name: approval-channel
1078+
' | kubectl apply -f -
10691079
```
10701080

10711081
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:
10811091
system: |
10821092
You are a helpful assistant. Your job is to help the user with their tasks.
10831093
mcpServers:
1084-
- name: fetch' | kubectl apply -f -
1094+
- name: fetch
1095+
' | kubectl apply -f -
10851096
```
10861097

10871098
The fun part: Create a new task that uses the `fetch` tool to test the human approval workflow.
@@ -1094,7 +1105,8 @@ metadata:
10941105
spec:
10951106
agentRef:
10961107
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 -
10981110
```
10991111

11001112
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:
11781190
email:
11791191
address: "$MY_EMAIL"
11801192
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 -
11821195
```
11831196

11841197
Alright, we're ready for a brand new agent:
@@ -1196,7 +1209,8 @@ spec:
11961209
mcpServers:
11971210
- name: fetch
11981211
humanContactChannels:
1199-
- name: human-expert' | kubectl apply -f -
1212+
- name: human-expert
1213+
' | kubectl apply -f -
12001214
```
12011215

12021216
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:
12091223
spec:
12101224
agentRef:
12111225
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 -
12131228
```
12141229

12151230
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.

acp/config/manager/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
55
kind: Kustomization
66
images:
77
- name: controller
8-
newName: example.com/acp
9-
newTag: v0.0.1
8+
newName: ghcr.io/humanlayer/agentcontrolplane
9+
newTag: v0.6.1

acp/config/release/latest-crd.yaml

Lines changed: 107 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ spec:
4949
spec:
5050
description: AgentSpec defines the desired state of Agent
5151
properties:
52+
description:
53+
description: |-
54+
Description is an optional description for an agent.
55+
If present, it's included in any "delegateToAgent" tool descriptions
56+
type: string
5257
humanContactChannels:
5358
description: HumanContactChannels is a list of ContactChannel resources
5459
that can be used for human interactions
@@ -88,6 +93,22 @@ spec:
8893
- name
8994
type: object
9095
type: array
96+
subAgents:
97+
description: |-
98+
SubAgents is a list of local object references to other Agents
99+
that can be delegated to as sub-agents.
100+
items:
101+
description: LocalObjectReference contains enough information to
102+
locate the referenced resource in the same namespace
103+
properties:
104+
name:
105+
description: Name of the referent
106+
minLength: 1
107+
type: string
108+
required:
109+
- name
110+
type: object
111+
type: array
91112
system:
92113
description: System is the system prompt for the agent
93114
minLength: 1
@@ -147,6 +168,18 @@ spec:
147168
- name
148169
type: object
149170
type: array
171+
validSubAgents:
172+
description: ValidSubAgents is the list of sub-agents that were successfully
173+
validated
174+
items:
175+
properties:
176+
name:
177+
description: Name of the sub-agent
178+
type: string
179+
required:
180+
- name
181+
type: object
182+
type: array
150183
type: object
151184
type: object
152185
served: true
@@ -726,6 +759,9 @@ spec:
726759
scope: Namespaced
727760
versions:
728761
- additionalPrinterColumns:
762+
- jsonPath: .spec.agentRef.name
763+
name: Agent
764+
type: string
729765
- jsonPath: .status.ready
730766
name: Ready
731767
type: boolean
@@ -793,13 +829,81 @@ spec:
793829
required:
794830
- name
795831
type: object
832+
contextWindow:
833+
description: |-
834+
ContextWindow provides the initial conversation context when creating a Task.
835+
If provided, contextWindow will be used and userMessage must be empty.
836+
This will be copied to status.ContextWindow, which is the source of truth
837+
for the ongoing conversation.
838+
items:
839+
description: Message represents a single message in the conversation
840+
properties:
841+
content:
842+
description: Content is the message content
843+
type: string
844+
name:
845+
description: Name is the name of the tool that was called
846+
type: string
847+
role:
848+
description: Role is the role of the message sender (system,
849+
user, assistant, tool)
850+
enum:
851+
- system
852+
- user
853+
- assistant
854+
- tool
855+
type: string
856+
toolCallId:
857+
description: ToolCallID is the unique identifier for this tool
858+
call
859+
type: string
860+
toolCalls:
861+
description: ToolCalls contains any tool calls requested by
862+
this message
863+
items:
864+
description: ToolCall represents a request to call a tool
865+
properties:
866+
function:
867+
description: Function contains the details of the function
868+
to call
869+
properties:
870+
arguments:
871+
description: Arguments contains the arguments to pass
872+
to the function in JSON format
873+
type: string
874+
name:
875+
description: Name is the name of the function to call
876+
type: string
877+
required:
878+
- arguments
879+
- name
880+
type: object
881+
id:
882+
description: ID is the unique identifier for this tool
883+
call
884+
type: string
885+
type:
886+
description: Type indicates the type of tool call. Currently
887+
only "function" is supported.
888+
type: string
889+
required:
890+
- function
891+
- id
892+
- type
893+
type: object
894+
type: array
895+
required:
896+
- content
897+
- role
898+
type: object
899+
type: array
796900
userMessage:
797-
description: UserMessage is the message to send to the agent.
798-
minLength: 1
901+
description: |-
902+
UserMessage is the message to send to the agent.
903+
If provided, userMessage will be used and contextWindow must be empty.
799904
type: string
800905
required:
801906
- agentRef
802-
- userMessage
803907
type: object
804908
status:
805909
description: TaskStatus defines the observed state of Task

0 commit comments

Comments
 (0)