calculator_with_tests.py
1 """Calculator with Tests - Editor Output Example. 2 3 Builds a calculator module, writes unit tests, runs them, generates a 4 coverage-style report, and reads it back. 5 """ 6 from praisonaiagents import Agent 7 from praisonaiagents.tools import ( 8 write_file, read_file, execute_command 9 ) 10 11 agent = Agent( 12 instructions="You are a helpful coding assistant.", 13 output="editor", 14 tools=[write_file, read_file, execute_command], 15 approval=True, 16 ) 17 agent.start( 18 "Build a mini calculator - create /tmp/calculator.py with add, subtract, " 19 "multiply, divide functions, write unit tests in /tmp/test_calculator.py " 20 "using unittest, run the tests to make sure they pass, then generate a " 21 "coverage-style report in /tmp/calc_report.md listing which functions were " 22 "tested and read it back" 23 )