Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
60bfaa2
feat: add skeleton of openai-agent skills
EItanya Oct 29, 2025
1b8d662
refactor kagent skills with basic tests
supreme-gg-gg Nov 6, 2025
5ad4153
cleanup some kagent openai
supreme-gg-gg Nov 6, 2025
ec8d961
use kagent skills in adk
supreme-gg-gg Nov 6, 2025
580b542
create session tmp working dir in openai executor
supreme-gg-gg Nov 6, 2025
522a7ec
fixes to kagent openai
supreme-gg-gg Nov 11, 2025
100a541
minor fixes to other packages
supreme-gg-gg Nov 11, 2025
f19d0ba
e2e test for openai
supreme-gg-gg Nov 11, 2025
bfee60a
refactor kagent adk
supreme-gg-gg Nov 12, 2025
2664571
improvements to python path and path
supreme-gg-gg Nov 12, 2025
12111f0
update openai sdk
supreme-gg-gg Nov 12, 2025
76f9714
fix openai sample and add to makefile
supreme-gg-gg Nov 12, 2025
b26ac94
restore files from main
supreme-gg-gg Nov 12, 2025
98ad2e0
fix ci
supreme-gg-gg Dec 4, 2025
7b73ecb
update dockerfile to initialize new venv with pip
supreme-gg-gg Dec 4, 2025
4397d32
remove pip from bash venv
supreme-gg-gg Dec 4, 2025
a819c66
fix e2e and lint
supreme-gg-gg Dec 4, 2025
bf2e044
python lint
supreme-gg-gg Dec 4, 2025
08ff646
fix merge conflicts
supreme-gg-gg Jan 6, 2026
8bf35ff
fixes
supreme-gg-gg Jan 6, 2026
1029d63
fix kebab agent issue
supreme-gg-gg Jan 7, 2026
731e51e
configure mockllm base url in openai sdk
supreme-gg-gg Jan 7, 2026
e39c150
make tracing work and fix deps
supreme-gg-gg Jan 8, 2026
22d7731
update mockllm to latest
supreme-gg-gg Jan 12, 2026
32edfa2
fix mocks
supreme-gg-gg Jan 12, 2026
252f1c6
change exact match to contains
supreme-gg-gg Jan 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ push-test-agent: buildx-create build-kagent-adk
$(DOCKER_BUILDER) build --push $(BUILD_ARGS) $(TOOLS_IMAGE_BUILD_ARGS) -t $(DOCKER_REGISTRY)/kebab:latest -f go/test/e2e/agents/kebab/Dockerfile ./go/test/e2e/agents/kebab
kubectl apply --namespace kagent --context kind-$(KIND_CLUSTER_NAME) -f go/test/e2e/agents/kebab/agent.yaml
$(DOCKER_BUILDER) build --push $(BUILD_ARGS) $(TOOLS_IMAGE_BUILD_ARGS) -t $(DOCKER_REGISTRY)/poem-flow:latest -f python/samples/crewai/poem_flow/Dockerfile ./python

$(DOCKER_BUILDER) build --push $(BUILD_ARGS) $(TOOLS_IMAGE_BUILD_ARGS) -t $(DOCKER_REGISTRY)/basic-openai:latest -f python/samples/openai/basic_agent/Dockerfile ./python

.PHONY: push-test-skill
push-test-skill: buildx-create
echo "Building FROM DOCKER_REGISTRY=$(DOCKER_REGISTRY)/$(DOCKER_REPO)/kebab-maker:$(VERSION)"
Expand Down
6 changes: 3 additions & 3 deletions go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/hashicorp/go-multierror v1.1.1
github.com/jedib0t/go-pretty/v6 v6.6.8
github.com/kagent-dev/kmcp v0.2.2
github.com/kagent-dev/mockllm v0.0.2
github.com/kagent-dev/mockllm v0.0.3
github.com/mark3labs/mcp-go v0.40.0
github.com/muesli/reflow v0.3.0
github.com/prometheus/client_golang v1.23.2
Expand All @@ -39,7 +39,7 @@ require (

require (
github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db // indirect
github.com/anthropics/anthropic-sdk-go v1.13.0 // indirect
github.com/anthropics/anthropic-sdk-go v1.19.0 // indirect
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/aymanbagabas/go-udiff v0.3.1 // indirect
Expand All @@ -60,7 +60,7 @@ require (
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/openai/openai-go v1.12.0 // indirect
github.com/openai/openai-go/v3 v3.16.0 // indirect
github.com/sahilm/fuzzy v0.1.1 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.2.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ github.com/abiosoft/ishell/v2 v2.0.2 h1:5qVfGiQISaYM8TkbBl7RFO6MddABoXpATrsFbVI+
github.com/abiosoft/ishell/v2 v2.0.2/go.mod h1:E4oTCXfo6QjoCart0QYa5m9w4S+deXs/P/9jA77A9Bs=
github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db h1:CjPUSXOiYptLbTdr1RceuZgSFDQ7U15ITERUGrUORx8=
github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530=
github.com/anthropics/anthropic-sdk-go v1.13.0 h1:Bhbe8sRoDPtipttg8bQYrMCKe2b79+q6rFW1vOKEUKI=
github.com/anthropics/anthropic-sdk-go v1.13.0/go.mod h1:WTz31rIUHUHqai2UslPpw5CwXrQP3geYBioRV4WOLvE=
github.com/anthropics/anthropic-sdk-go v1.19.0 h1:mO6E+ffSzLRvR/YUH9KJC0uGw0uV8GjISIuzem//3KE=
github.com/anthropics/anthropic-sdk-go v1.19.0/go.mod h1:WTz31rIUHUHqai2UslPpw5CwXrQP3geYBioRV4WOLvE=
github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
Expand Down Expand Up @@ -165,8 +165,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kagent-dev/kmcp v0.2.2 h1:uvbKmo9IT6OT9RBNXYwGX0PWyxBLfAW1F9yWd5/wxaI=
github.com/kagent-dev/kmcp v0.2.2/go.mod h1:g7wS/3m2wonRo/1DMwVoHxnilr/urPgV2hwV1DwkwrQ=
github.com/kagent-dev/mockllm v0.0.2 h1:xtzXJAacsePYzmzWATxBfd4/AN3Xp27BiGVBPygnl1I=
github.com/kagent-dev/mockllm v0.0.2/go.mod h1:AfO/c+hIYRvO50YfXoYTFcjbiwXxzYFc/efsTcFpoLU=
github.com/kagent-dev/mockllm v0.0.3 h1:hk6Oa/vxHoBrGqRig4GCzox8EqRQYXM4c3oFPP/k9Tg=
github.com/kagent-dev/mockllm v0.0.3/go.mod h1:tDLemRsTZa1NdHaDbg3sgFk9cT1QWvMPlBtLVD6I2mA=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
Expand Down Expand Up @@ -228,8 +228,8 @@ github.com/onsi/ginkgo/v2 v2.25.3 h1:Ty8+Yi/ayDAGtk4XxmmfUy4GabvM+MegeB4cDLRi6nw
github.com/onsi/ginkgo/v2 v2.25.3/go.mod h1:43uiyQC4Ed2tkOzLsEYm7hnrb7UJTWHYNsuy3bG/snE=
github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
github.com/openai/openai-go v1.12.0 h1:NBQCnXzqOTv5wsgNC36PrFEiskGfO5wccfCWDo9S1U0=
github.com/openai/openai-go v1.12.0/go.mod h1:g461MYGXEXBVdV5SaR/5tNzNbSfwTBBefwc+LlDCK0Y=
github.com/openai/openai-go/v3 v3.16.0 h1:VdqS+GFZgAvEOBcWNyvLVwPlYEIboW5xwiUCcLrVf8c=
github.com/openai/openai-go/v3 v3.16.0/go.mod h1:cdufnVK14cWcT9qA1rRtrXx4FTRsgbDPW7Ia7SS5cZo=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down
96 changes: 94 additions & 2 deletions go/test/e2e/invoke_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,45 @@ func TestE2EInvokeDeclarativeAgentWithMcpServerTool(t *testing.T) {
})
}

// This function generates a CrewAI agent that uses a mock LLM server
// Assumes that the image is built and pushed to registry, the agent can be found in python/samples/crewai/poem_flow
// This function generates an OpenAI BYO agent that uses a mock LLM server
// Assumes that the image is built and pushed to registry
func generateOpenAIAgent(baseURL string) *v1alpha2.Agent {
return &v1alpha2.Agent{
ObjectMeta: metav1.ObjectMeta{
Name: "basic-openai-test-agent",
Namespace: "kagent",
},
Spec: v1alpha2.AgentSpec{
Description: "A basic OpenAI agent with calculator and weather tools",
Type: v1alpha2.AgentType_BYO,
BYO: &v1alpha2.BYOAgentSpec{
Deployment: &v1alpha2.ByoDeploymentSpec{
Image: "localhost:5001/basic-openai:latest",
SharedDeploymentSpec: v1alpha2.SharedDeploymentSpec{
Env: []corev1.EnvVar{
{
Name: "OPENAI_API_KEY",
ValueFrom: &corev1.EnvVarSource{
SecretKeyRef: &corev1.SecretKeySelector{
LocalObjectReference: corev1.LocalObjectReference{
Name: "kagent-openai",
},
Key: "OPENAI_API_KEY",
},
},
},
{
Name: "OPENAI_API_BASE",
Value: baseURL + "/v1",
},
},
},
},
},
},
}
}

func generateCrewAIAgent(baseURL string) *v1alpha2.Agent {
return &v1alpha2.Agent{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -541,6 +578,59 @@ func generateCrewAIAgent(baseURL string) *v1alpha2.Agent {
}
}

func TestE2EInvokeOpenAIAgent(t *testing.T) {
// Setup mock server
baseURL, stopServer := setupMockServer(t, "mocks/invoke_openai_agent.json")
defer stopServer()

// Setup Kubernetes client
cli := setupK8sClient(t, false)

// Setup specific resources
modelCfg := setupModelConfig(t, cli, baseURL)
agent := generateOpenAIAgent(baseURL)

// Create the agent on the cluster
err := cli.Create(t.Context(), agent)
require.NoError(t, err)

// Wait for agent to be ready
args := []string{
"wait",
"--for",
"condition=Ready",
"--timeout=1m",
"agents.kagent.dev",
agent.Name,
"-n",
agent.Namespace,
}

cmd := exec.CommandContext(t.Context(), "kubectl", args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
require.NoError(t, cmd.Run())

defer func() {
cli.Delete(t.Context(), agent) //nolint:errcheck
cli.Delete(t.Context(), modelCfg) //nolint:errcheck
}()

// Setup A2A client - use the agent's actual name
a2aURL := a2aUrl("kagent", "basic-openai-test-agent")
a2aClient, err := a2aclient.NewA2AClient(a2aURL)
require.NoError(t, err)

useArtifacts := true
t.Run("sync_invocation_calculator", func(t *testing.T) {
runSyncTest(t, a2aClient, "What is 2+2?", "4", &useArtifacts)
})

t.Run("streaming_invocation_weather", func(t *testing.T) {
runStreamingTest(t, a2aClient, "What is the weather in London?", "Rainy, 52°F")
})
}

func TestE2EInvokeCrewAIAgent(t *testing.T) {
mockllmCfg, err := mockllm.LoadConfigFromFile("mocks/invoke_crewai_agent.json", mocks)
require.NoError(t, err)
Expand Down Expand Up @@ -619,6 +709,8 @@ func TestE2EInvokeCrewAIAgent(t *testing.T) {
t.Run("streaming_invocation", func(t *testing.T) {
runStreamingTest(t, a2aClient, "Generate a poem about CrewAI", "CrewAI is awesome, it makes coding fun.")
})

cli.Delete(t.Context(), agent) //nolint:errcheck
}

func TestE2EInvokeSTSIntegration(t *testing.T) {
Expand Down
9 changes: 5 additions & 4 deletions go/test/e2e/mocks/invoke_inline_agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
{
"name": "initial_request",
"match": {
"match_type": "exact",
"message" : {
"match_type": "contains",
"message": {
"content": "List all nodes in the cluster",
"role": "user"
}
Expand All @@ -23,6 +23,7 @@
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "k8s_get_resources",
"arguments": "{\"resource_type\": \"node\", \"all_namespaces\": true}"
Expand All @@ -39,7 +40,7 @@
"name": "k8s_get_resources_response",
"match": {
"match_type": "contains",
"message" : {
"message": {
"content": "kagent-control-plane",
"role": "tool",
"tool_call_id": "call_1"
Expand All @@ -62,4 +63,4 @@
}
}
]
}
}
7 changes: 4 additions & 3 deletions go/test/e2e/mocks/invoke_mcp_agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
{
"name": "initial_request",
"match": {
"match_type": "exact",
"message" : {
"match_type": "contains",
"message": {
"content": "add 3 and 5",
"role": "user"
}
Expand All @@ -23,6 +23,7 @@
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "add",
"arguments": "{\"a\": 3, \"b\": 5}"
Expand All @@ -39,7 +40,7 @@
"name": "add_response",
"match": {
"match_type": "contains",
"message" : {
"message": {
"content": "8",
"role": "tool",
"tool_call_id": "call_1"
Expand Down
130 changes: 130 additions & 0 deletions go/test/e2e/mocks/invoke_openai_agent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"openai": [
{
"name": "calculate_request",
"match": {
"match_type": "contains",
"message": {
"content": "What is 2+2?",
"role": "user"
}
},
"response": {
"id": "chatcmpl-calc",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-4.1-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_abc123",
"type": "function",
"function": {
"name": "calculate",
"arguments": "{\"expression\": \"2+2\"}"
}
}
]
},
"finish_reason": "tool_calls"
}
]
}
},
{
"name": "calculate_result",
"match": {
"match_type": "contains",
"message": {
"content": "4",
"role": "tool",
"tool_call_id": "call_abc123"
}
},
"response": {
"id": "chatcmpl-calc-result",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-4.1-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The result of 2+2 is 4"
},
"finish_reason": "stop"
}
]
}
},
{
"name": "weather_request",
"match": {
"match_type": "contains",
"message": {
"content": "What is the weather in London?",
"role": "user"
}
},
"response": {
"id": "chatcmpl-weather",
"object": "chat.completion",
"created": 1677652289,
"model": "gpt-4.1-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_def456",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"location\": \"London\"}"
}
}
]
},
"finish_reason": "tool_calls"
}
]
}
},
{
"name": "weather_result",
"match": {
"match_type": "contains",
"message": {
"content": "Rainy, 52°F",
"role": "tool",
"tool_call_id": "call_def456"
}
},
"response": {
"id": "chatcmpl-weather-result",
"object": "chat.completion",
"created": 1677652289,
"model": "gpt-4.1-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The weather in London is Rainy, 52°F"
},
"finish_reason": "stop"
}
]
}
}
]
}
Loading
Loading