Skip to content

Commit 71f59bf

Browse files
authored
feat: add deployment script and workflow (#21)
* feat: add deployment script and workflow * chore: add communication folder and api key * chore: add communication to paths filter
1 parent 1b12b4d commit 71f59bf

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed

.github/workflows/deploy-agents.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Deploy Agents
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '1-uagents/finance/**'
9+
- '1-uagents/geo/**'
10+
- '1-uagents/knowledge-base/**'
11+
- '1-uagents/search/**'
12+
- '1-uagents/travel/**'
13+
- '1-uagents/utility/**'
14+
- '1-uagents/communication/**'
15+
- 'scripts/deploy-all-agents.sh'
16+
17+
jobs:
18+
deploy:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Download latest AVCTL release binary
26+
run: |
27+
LATEST_RELEASE_URL=$(curl -s https://api.github.com/repos/fetchai/avctl/releases/latest \
28+
| grep browser_download_url \
29+
| grep avctl_Linux_x86_64.tar.gz \
30+
| cut -d '"' -f 4)
31+
32+
curl -L -o avctl_Linux_x86_64.tar.gz $LATEST_RELEASE_URL
33+
34+
- name: Extract binary and install
35+
run: |
36+
tar -xvf avctl_Linux_x86_64.tar.gz
37+
chmod +x avctl
38+
mv avctl /usr/local/bin/avctl
39+
40+
- name: Authenticate with Agentverse
41+
run: avctl auth token ${{ secrets.AGENTVERSE_API_KEY }}
42+
43+
- name: Deploy all agents
44+
run: ./scripts/deploy-all-agents.sh
45+
env:
46+
ALPHAVANTAGE_API_KEY: ${{ secrets.ALPHAVANTAGE_API_KEY }}
47+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
48+
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
49+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
50+
OCM_API_KEY: ${{ secrets.OCM_API_KEY }}
51+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
52+
OPENCAGE_API_KEY: ${{ secrets.OPENCAGE_API_KEY }}
53+
WEATHERAPI_KEY: ${{ secrets.WEATHERAPI_KEY }}
54+
HUGGINGFACE_API_KEY: ${{ secrets.HUGGINGFACE_API_KEY }}
55+
GEOAPIFY_API_KEY: ${{ secrets.GEOAPIFY_API_KEY }}
56+
TAVILY_API_KEY: ${{ secrets.TAVILY_API_KEY }}
57+
RAPIDAPI_API_KEY: ${{ secrets.RAPIDAPI_API_KEY }}
58+
SAPLING_API_KEY: ${{ secrets.SAPLING_API_KEY }}
59+
60+
- name: Commit and push changes (avctl folders for new agents)
61+
if: always()
62+
run: |
63+
COMMIT_MESSAGE="chore: add deployment configuration files for new agents"
64+
65+
git config --local user.email "[email protected]"
66+
git config --local user.name "fetch-bot"
67+
68+
# Add all new avctl files
69+
git add agents/**.avctl**
70+
71+
# Commit and push any changes
72+
if git diff --cached --quiet; then
73+
echo "No changes to commit"
74+
exit 0
75+
fi
76+
77+
git commit -m "$COMMIT_MESSAGE"
78+
git push origin main

scripts/deploy-all-agents.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
HOSTED_AGENTS_PATH="1-uagents"
2+
CATEGORIES=("finance" "geo" "knowledge-base" "search" "travel" "utility" "communication")
3+
4+
cd $HOSTED_AGENTS_PATH
5+
6+
for category in ${CATEGORIES[@]}; do
7+
for agent in $category/*; do
8+
cd $agent
9+
10+
echo "Deploying agent $agent..."
11+
12+
while IFS='=' read -r key value; do
13+
if cat *.py | grep -q $key; then
14+
echo "Adding secret $key to agent $agent..."
15+
echo "$key=$value" # >> .secrets
16+
fi
17+
done < <(printenv | grep API_KEY)
18+
19+
# Create a .avctl folder for new agents if it doesn't exist
20+
avctl hosting init
21+
22+
# Get the agent's name from the README.md top line header
23+
agent_name=$(head -n 1 README.md | sed -e 's/#//g' | xargs)
24+
25+
# Deploy the agent with secrets if they exist
26+
if [ -s .secrets ]; then
27+
avctl hosting deploy -n "$agent_name" -s .secrets --no-dependency-check || true
28+
else
29+
avctl hosting deploy -n "$agent_name" --no-dependency-check || true
30+
fi
31+
32+
cd ../..
33+
done
34+
done

0 commit comments

Comments
 (0)