Skip to content

Update the github workflow with ollama #1

Update the github workflow with ollama

Update the github workflow with ollama #1

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Cerebrum-AIOS Integration Test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
# Clone AIOS
- name: Git Clone AIOS
uses: actions/checkout@v4
with:
repository: agiresearch/AIOS
path: aios_root
ref: main
# Verify AIOS clone
- name: Verify AIOS clone
run: |
echo "=== AIOS root directory contents ==="
ls -la aios_root/
echo "=== Looking for setup files ==="
find aios_root/ -name "setup.py" -o -name "pyproject.toml"
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
# Install AIOS dependencies
- name: Install AIOS dependencies
working-directory: aios_root
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# Clone Cerebrum into AIOS directory
- name: Checkout Cerebrum
uses: actions/checkout@v4
with:
path: aios_root/Cerebrum
ref: ${{ github.ref }}
# Install Cerebrum
- name: Install Cerebrum
run: |
python -m pip install -e aios_root/Cerebrum/
# Run AIOS kernel
- name: Run AIOS kernel in background
run: |
cd aios_root
bash runtime/launch_kernel.sh &>../kernel.log &
KERNEL_PID=$!
cd ..
# Set maximum wait time (10 seconds)
max_wait=10
start_time=$SECONDS
# Dynamically check if the process is running until it succeeds or times out
while true; do
if ! ps -p $KERNEL_PID > /dev/null; then
echo "Kernel process died. Checking logs:"
cat kernel.log
exit 1
fi
if nc -z localhost 8000; then
if curl -s http://localhost:8000/health; then
echo "Kernel successfully started and healthy"
break
fi
fi
# Check if timed out
elapsed=$((SECONDS - start_time))
if [ $elapsed -ge $max_wait ]; then
echo "Timeout after ${max_wait} seconds. Kernel failed to start properly."
cat kernel.log
exit 1
fi
echo "Waiting for kernel to start... (${elapsed}s elapsed)"
sleep 1
done
# Run integration test
- name: Download and install Ollama
run: |
curl -fsSL https://ollama.com/install.sh | sh
- name: Pull Ollama models
run: |
ollama pull llama3:8b
- name: Run Ollama serve
run: |
ollama serve 2>&1 | tee ollama-llm.log
- name: Run integration test
run: |
# Debug information
echo "Checking kernel status..."
curl -v http://localhost:8000/health || true
echo "Network status:"
netstat -tlpn | grep 8000 || true
# Run the test
run-agent \
--llm_name llama3:8b \
--llm_backend ollama \
--agent_name_or_path demo_author/demo_agent \
--task "Tell me what is core idea of AIOS" \
--aios_kernel_url http://localhost:8000 \
2>&1 | tee agent.log
# Check for error patterns
if grep -q "Failed to initialize client: 500 Server Error" agent.log; then
echo "Error: LLM initialization failed. Please check your API key configuration."
exit 1
fi
# Check if completed successfully
if ! grep -q "Final Result:" agent.log; then
echo "Error: Agent did not complete successfully"
exit 1
fi
# Upload logs
- name: Upload logs
if: always()
uses: actions/[email protected]
with:
name: test-logs
path: |
kernel.log
agent.log
# Debug information
- name: Debug information
if: failure()
run: |
echo "=== Kernel log ==="
cat kernel.log
echo "=== Environment variables ==="
env | grep -i api_key || true
echo "=== Process status ==="
ps aux | grep kernel
echo "=== Directory structure ==="
tree aios_main || true