Skip to content

Commit 09bd7e5

Browse files
muscariellopbalogh-samsardara
authored
chore: fix test applications (#4)
* chore: fix test applications Signed-off-by: Luca Muscariello <lumuscar@cisco.com> Signed-off-by: Peter Balogh <p.balogh.sa@gmail.com> Co-authored-by: Peter Balogh <p.balogh.sa@gmail.com> Co-authored-by: Mauro Sardara <11283032+msardara@users.noreply.github.com>
1 parent 0b2846b commit 09bd7e5

File tree

44 files changed

+511
-1003
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+511
-1003
lines changed

.github/actions/setup-k8s/action.yaml

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,7 @@ inputs:
1818
description: 'Kind version'
1919
required: false
2020
default: "0.24.0"
21-
kind-create-cluster:
22-
description: 'Create kind K8s cluster'
23-
required: false
24-
default: "false"
25-
kind-cluster-name:
26-
description: 'Kind K8s cluster name to create'
27-
required: false
28-
default: "kind"
29-
kind-cluster-gateway:
30-
description: 'Gateway IP to use for kind server nodes. Useful when running actions inside containers.'
31-
required: false
32-
default: "127.0.0.1"
21+
3322
runs:
3423
using: "composite"
3524
steps:
@@ -55,23 +44,3 @@ runs:
5544
- name: Setup kubectl
5645
uses: azure/setup-kubectl@3e0aec4d80787158d308d7b364cb1b702e7feb7f # v4.0.0
5746

58-
#
59-
# Setup cluster
60-
#
61-
- name: Setup Kind cluster
62-
if: ${{ inputs.kind-create-cluster == 'true' }}
63-
shell: bash
64-
run: |
65-
# Create cluster config
66-
KIND_CONFIG_FILE=$(mktemp -p /tmp)
67-
cat <<EOF > $KIND_CONFIG_FILE
68-
kind: Cluster
69-
apiVersion: kind.x-k8s.io/v1alpha4
70-
networking:
71-
apiServerAddress: "${{ inputs.kind-cluster-gateway }}"
72-
apiServerPort: 6443
73-
EOF
74-
75-
# Create cluster
76-
kind create cluster --config $KIND_CONFIG_FILE --name ${{ inputs.kind-cluster-name }}
77-
kubectl cluster-info

.github/workflows/release.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ jobs:
3535
id: resolve
3636
run: |
3737
# Export vars
38-
tag=$(task version)
39-
echo "image_tag=${tag}" >> "$GITHUB_OUTPUT"
38+
echo "image_tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
4039
4140
- name: List all targets
4241
id: all-targets

.github/workflows/test-integrations.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,19 @@ jobs:
5959
task kind:create
6060
shell: bash
6161

62-
- name: Deploy Phoenix directory
62+
- name: Deploy agntcy agp
6363
run: |
6464
cd integrations
6565
task test:env:gateway:deploy
6666
shell: bash
6767

6868
- name: Run simple gateway tests
69+
env:
70+
AZURE_OPENAI_ENDPOINT: ${{ vars.AZURE_OPENAI_ENDPOINT }}
71+
AZURE_MODEL_VERSION: ${{ vars.AZURE_MODEL_VERSION }}
72+
AZURE_DEPLOYMENT_NAME: ${{ vars.AZURE_DEPLOYMENT_NAME }}
73+
AZURE_OPENAI_API_VERSION: ${{ vars.AZURE_OPENAI_API_VERSION }}
74+
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
6975
run: |
7076
cd integrations
7177
task test:gateway

.github/workflows/test-samples.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ jobs:
6868
kind-version: "0.25.0"
6969

7070
- name: Run tests
71+
env:
72+
AZURE_OPENAI_ENDPOINT: ${{ vars.AZURE_OPENAI_ENDPOINT }}
73+
AZURE_MODEL_VERSION: ${{ vars.AZURE_MODEL_VERSION }}
74+
AZURE_DEPLOYMENT_NAME: ${{ vars.AZURE_DEPLOYMENT_NAME }}
75+
AZURE_OPENAI_API_VERSION: ${{ vars.AZURE_OPENAI_API_VERSION }}
76+
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
7177
run: |
7278
cd ${{ matrix.app }}
7379
task run:test

integrations/Taskfile.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@ version: '3'
77
silent: true
88

99
vars:
10-
KIND_CLUSTER_NAME: '{{ .KIND_CLUSTER_NAME | default "phoenix-test" }}'
10+
KIND_CLUSTER_NAME: '{{ .KIND_CLUSTER_NAME | default "agntcy-test" }}'
1111

1212
## Image config
1313
IMAGE_REPO: '{{ .IMAGE_REPO | default "ghcr.io/agntcy" }}'
14-
GATEWAY_IMAGE_TAG: '{{ .GATEWAY_IMAGE_TAG | default "0.1.0-rc0-2-g421c6ce" }}'
14+
GATEWAY_IMAGE_TAG: '{{ .GATEWAY_IMAGE_TAG | default "0.1.0-rc0-10-g794c425" }}'
1515

1616
IMAGE_BAKE_OPTS: '{{ .IMAGE_BAKE_OPTS | default "--set *.platform=linux/arm64" }}'
17-
TEST_APP_TAG: '{{ .TEST_APP_TAG | default "v0.0.0-dev" }}'
17+
TEST_APP_TAG: '{{ .TEST_APP_TAG | default "v0.0.1" }}'
1818

1919
AZURE_OPENAI_API_KEY: '{{ .AZURE_OPENAI_API_KEY | default "" }}'
2020
AZURE_OPENAI_ENDPOINT: '{{ .AZURE_OPENAI_ENDPOINT | default "" }}'
2121

22+
HELM_NAMESPACE: '{{ .HELM_NAMESPACE | default "default" }}'
23+
2224

2325
tasks:
2426
default:
@@ -30,15 +32,14 @@ tasks:
3032
cmds:
3133
- kind create cluster --name {{.KIND_CLUSTER_NAME}} --wait 60s || true
3234
- kubectl cluster-info --context kind-{{.KIND_CLUSTER_NAME}}
33-
- task: kind:load-images
3435

3536
kind:destroy:
3637
desc: Destroy kind cluster
3738
cmds:
3839
- kind delete cluster --name {{.KIND_CLUSTER_NAME}}
3940

4041
kind:load-images:
41-
internal: true
42+
desc: Pull and load images to kind
4243
cmds:
4344
# pull images
4445
- docker pull {{.IMAGE_REPO}}/agp/gw:{{.GATEWAY_IMAGE_TAG}}
@@ -48,24 +49,24 @@ tasks:
4849
k8s:port-forward:setup:gateway:
4950
internal: true
5051
cmds:
51-
- kubectl port-forward svc/agntcy-agp-gateway -n default 46357 &
52+
- kubectl port-forward svc/agntcy-agp -n {{ .HELM_NAMESPACE }} 46357 &
5253
- sleep 1
5354

5455
k8s:port-forward:teardown:gateway:
5556
internal: true
5657
cmds:
57-
- kill -9 $(ps aux | grep port-forward | grep agntcy-agp-gateway | awk '{print $2}') || true
58+
- kill -9 $(ps aux | grep port-forward | grep agntcy-agp | awk '{print $2}') || true
5859

5960
test:env:gateway:deploy:
60-
desc: Deploy Phoenix gateway test env
61-
vars:
62-
HELM_NAMESPACE: '{{ .HELM_NAMESPACE | default "default" }}'
61+
desc: Deploy agent gateway test env
62+
deps:
63+
- kind:load-images
6364
cmds:
6465
- |
6566
helm dependency build ./agntcy-agp/components/helm
6667
helm upgrade agntcy-agp \
6768
./agntcy-agp/components/helm \
68-
--set gateway.image.tag="{{ .GATEWAY_IMAGE_TAG }}" \
69+
--set agp.image.tag="{{ .GATEWAY_IMAGE_TAG }}" \
6970
--namespace {{ .HELM_NAMESPACE }} \
7071
--create-namespace \
7172
--install \
@@ -74,17 +75,15 @@ tasks:
7475
--timeout "15m"
7576
7677
test:env:gateway:cleanup:
77-
desc: Remove Phoenix gateway test env
78-
vars:
79-
HELM_NAMESPACE: '{{ .HELM_NAMESPACE | default "default" }}'
78+
desc: Remove agent gateway test env
8079
cmds:
8180
- helm delete --namespace {{ .HELM_NAMESPACE }} agntcy-agp
8281

8382
build:gateway:agentic-apps:
8483
desc: Build agentic containers
8584
dir: ./agntcy-agp/agentic-apps
8685
cmds:
87-
- docker buildx bake {{ .IMAGE_BAKE_OPTS }} --load
86+
- IMAGE_TAG={{ .TEST_APP_TAG }} docker buildx bake {{ .IMAGE_BAKE_OPTS }} --load
8887

8988
test:autogen-agent:run:
9089
internal: true
@@ -125,6 +124,7 @@ tasks:
125124
- defer: { task: k8s:port-forward:teardown:gateway }
126125
- task: test:autogen-agent:run
127126
- defer: { task: test:autogen-agent:remove }
127+
- docker pull {{ .IMAGE_REPO }}/csit/test-langchain-agent:{{ .TEST_APP_TAG }}
128128
- IMAGE_REPO={{.IMAGE_REPO}} TEST_APP_TAG={{.TEST_APP_TAG}} go test ./agntcy-agp/tests -v -failfast -test.v -test.paniconexit0 -ginkgo.timeout 30m -timeout 30m -ginkgo.v
129129

130130
version:

integrations/agntcy-agp/agentic-apps/autogen_agent/Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ ENV POETRY_HOME=/opt/poetry
99
ENV POETRY_VENV=/opt/poetry-venv
1010
ENV POETRY_CACHE_DIR=/opt/.cache
1111

12-
ARG POETRY_HTTP_BASIC_DEVHUBCLOUD_USERNAME
13-
ARG POETRY_HTTP_BASIC_DEVHUBCLOUD_PASSWORD
14-
1512
# Install rust
1613
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
1714

integrations/agntcy-agp/agentic-apps/autogen_agent/autogen_agent.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,34 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
import asyncio
5-
# import phoenix
65
from simple_agentic_app.simple_agentic_app import simple_autogen_app
76

87
import argparse
9-
import gateway_bindings
8+
import agp_bindings
109

11-
phoenix = gateway_bindings.Phoenix()
10+
gateway = agp_bindings.Gateway()
1211

13-
async def run_agent(gateway):
12+
async def run_agent(address):
1413
agent = simple_autogen_app()
1514

16-
# register local agent
17-
await phoenix.create_agent("cisco", "default", "autogen")
15+
local_organization = "cisco"
16+
local_namespace = "default"
17+
local_agent = "autogen"
1818

19-
# connect to gateway server
20-
await phoenix.connect(gateway)
19+
# Connect to the gateway server
20+
local_agent_id = await gateway.create_agent(
21+
local_organization, local_namespace, local_agent
22+
)
23+
24+
# Connect to the service and subscribe for the local name
25+
_ = await gateway.connect(address, insecure=True)
26+
await gateway.subscribe(
27+
local_organization, local_namespace, local_agent, local_agent_id
28+
)
2129

2230
while True:
2331
# receive messages
24-
src, msg = await phoenix.receive()
32+
src, msg = await gateway.receive()
2533

2634
# handle received messages
2735
result = await agent.initate_chat(msg)
@@ -32,7 +40,7 @@ async def run_agent(gateway):
3240
weather_question = result.inner_messages[-1].content[-1].content.split(":")
3341
if weather_question[0] == "WEATHER":
3442
print("about to send back: ", weather_question[1])
35-
await phoenix.publish_to(weather_question[1].encode(), src)
43+
await gateway.publish_to(weather_question[1].encode(), src)
3644

3745
def main():
3846
parser = argparse.ArgumentParser(description="Command line client for message passing.")

0 commit comments

Comments
 (0)