/ .github / workflows / test-windows.yml
test-windows.yml
  1  name: Windows Tests
  2  
  3  on:
  4    push:
  5      branches: [main, develop]
  6      paths:
  7        - 'src/**'
  8        - 'pyproject.toml'
  9        - '.github/workflows/test-windows.yml'
 10    pull_request:
 11      branches: [main, develop]
 12      paths:
 13        - 'src/**'
 14        - 'pyproject.toml'
 15        - '.github/workflows/test-windows.yml'
 16    workflow_dispatch:
 17  
 18  jobs:
 19    test-windows:
 20      runs-on: windows-latest
 21      timeout-minutes: 5
 22      env:
 23        OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
 24        OPENAI_MODEL_NAME: gpt-4o-mini
 25        PYTHONUTF8: 1
 26      
 27      steps:
 28      - uses: actions/checkout@v4
 29          with:
 30            persist-credentials: false
 31      - name: Set up Python 3.11
 32        uses: actions/setup-python@v5
 33        with:
 34          python-version: "3.11"
 35      
 36      - name: Install praisonaiagents
 37        run: |
 38          python -m pip install --upgrade pip
 39          cd src/praisonai-agents
 40          pip install -e .
 41        shell: bash
 42      
 43      - name: Install praisonai wrapper
 44        run: |
 45          cd src/praisonai
 46          pip install -e .
 47        shell: bash
 48  
 49      # ==================== CORE IMPORTS ====================
 50      - name: Test core imports
 51        run: |
 52          python -c "from praisonaiagents import Agent, Agents, Workflow; print('Core imports OK')"
 53          python -c "from praisonaiagents import tool, Tools; print('Tool imports OK')"
 54          python -c "from praisonaiagents import Task; print('Task imports OK')"
 55  
 56      # ==================== AGENT FEATURES ====================
 57      - name: Test Agent instantiation
 58        run: |
 59          python -c "
 60          from praisonaiagents import Agent
 61          a = Agent(name='Test', instructions='You are helpful')
 62          print('Agent created:', a.name)
 63          a2 = Agent(name='ToolAgent', instructions='Use tools', tools=[])
 64          print('Agent with tools:', a2.name)
 65          "
 66  
 67      - name: Test Agents orchestration
 68        run: |
 69          python -c "
 70          from praisonaiagents import Agent, Agents, Task
 71          a1 = Agent(name='Agent1', instructions='First agent')
 72          a2 = Agent(name='Agent2', instructions='Second agent')
 73          t = Task(description='Do something', agent=a1)
 74          agents = Agents(agents=[a1, a2], tasks=[t])
 75          print('Agents:', len(agents.agents), 'Tasks:', len(agents.tasks))
 76          "
 77  
 78      # ==================== WORKFLOW FEATURES ====================
 79      - name: Test Workflow
 80        run: |
 81          python -c "
 82          from praisonaiagents import Workflow
 83          
 84          w = Workflow(name='test')
 85          print('Workflow:', w.name)
 86          "
 87  
 88      # ==================== MEMORY FEATURES ====================
 89      - name: Test Memory classes
 90        run: |
 91          python -c "
 92          from praisonaiagents.memory import FileMemory
 93          from praisonaiagents.config import MemoryConfig
 94          
 95          cfg = MemoryConfig(backend='file', user_id='test_user')
 96          print('MemoryConfig backend:', cfg.backend)
 97          
 98          mem = FileMemory(user_id='test_user', base_path='.praison/test_memory')
 99          print('FileMemory user:', mem.user_id)
100          "
101  
102      # ==================== TOOL DECORATOR ====================
103      - name: Test tool decorator
104        run: |
105          python -c "
106          from praisonaiagents import tool
107          
108          @tool
109          def my_tool(query: str) -> str:
110              '''A test tool'''
111              return f'Echo: {query}'
112          
113          result = my_tool('hello')
114          print('Tool result:', result)
115          "
116  
117      # ==================== CONFIG CLASSES ====================
118      - name: Test config classes
119        run: |
120          python -c "
121          from praisonaiagents.config import OutputConfig, ExecutionConfig, PlanningConfig
122          
123          out_cfg = OutputConfig(verbose=True, stream=True)
124          print('OutputConfig verbose:', out_cfg.verbose)
125          
126          exec_cfg = ExecutionConfig(max_iter=50, max_retry_limit=5)
127          print('ExecutionConfig max_iter:', exec_cfg.max_iter)
128          
129          plan_cfg = PlanningConfig(reasoning=True, auto_approve=False)
130          print('PlanningConfig reasoning:', plan_cfg.reasoning)
131          "
132      # ==================== HANDOFF ====================
133      - name: Test Handoff
134        run: |
135          python -c "
136          from praisonaiagents import Handoff, handoff, Agent
137          
138          a1 = Agent(name='Agent1', instructions='First')
139          a2 = Agent(name='Agent2', instructions='Second')
140          
141          # Using Handoff class directly
142          h = Handoff(agent=a2)
143          print('Handoff tool name:', h.tool_name)
144          
145          # Using handoff function
146          h2 = handoff(a1, tool_name_override='custom_handoff')
147          print('Custom handoff name:', h2.tool_name)
148          "
149  
150  
151      # ==================== ASYNC FEATURES ====================
152      - name: Test async imports
153        run: |
154          python -c "
155          import asyncio
156          from praisonaiagents import Agent
157          
158          async def test_async():
159              agent = Agent(name='AsyncAgent', instructions='Test')
160              assert hasattr(agent, 'arun'), 'Missing arun'
161              assert hasattr(agent, 'astart'), 'Missing astart'
162              print('Async methods available')
163          
164          asyncio.run(test_async())
165          "
166  
167      # ==================== CLI COMMANDS ====================
168      - name: Test CLI help
169        run: praisonai --help
170  
171      - name: Test CLI session list
172        run: praisonai session list
173        continue-on-error: true
174  
175      - name: Test CLI queue list
176        run: praisonai queue list
177        continue-on-error: true
178  
179      # ==================== REAL API TESTS ====================
180      - name: Real API test - Agent run
181        if: env.OPENAI_API_KEY != ''
182        run: |
183          python -c "
184          from praisonaiagents import Agent
185          agent = Agent(name='TestAgent', instructions='Reply with exactly: WINDOWS_OK', llm='gpt-4o-mini')
186          result = agent.run('Say WINDOWS_OK')
187          print('Result:', result)
188          print('Real API test passed')
189          "
190  
191      - name: Real API test - Multi-agent
192        if: env.OPENAI_API_KEY != ''
193        run: |
194          python -c "
195          from praisonaiagents import Agent, Agents, Task
196          
197          researcher = Agent(name='Researcher', instructions='You research topics', llm='gpt-4o-mini')
198          writer = Agent(name='Writer', instructions='You write content', llm='gpt-4o-mini')
199          
200          task = Task(description='Say hello world', agent=researcher)
201          
202          agents = Agents(agents=[researcher, writer], tasks=[task])
203          result = agents.start()
204          print('Multi-agent result type:', type(result))
205          print('Multi-agent test passed')
206          "