diff --git a/bagit.py b/bagit.py
index 18c61da..d97b4b5 100755
--- a/bagit.py
+++ b/bagit.py
@@ -47,6 +47,8 @@ from os.path import abspath, isdir, isfile, join
 
 LOGGER = logging.getLogger(__name__)
 
+VERSION = '1.5.4'
+
 # standard bag-info.txt metadata
 STANDARD_BAG_INFO_HEADERS = [
     'Source-Organization',
@@ -141,7 +143,7 @@ def make_bag(bag_dir, bag_info=None, processes=1, checksum=None):
             if 'Bagging-Date' not in bag_info:
                 bag_info['Bagging-Date'] = date.strftime(date.today(), "%Y-%m-%d")
             if 'Bag-Software-Agent' not in bag_info:
-                bag_info['Bag-Software-Agent'] = 'bagit.py <http://github.com/libraryofcongress/bagit-python>'
+                bag_info['Bag-Software-Agent'] = 'bagit.py v' + VERSION + ' <http://github.com/libraryofcongress/bagit-python>'
             bag_info['Payload-Oxum'] = Oxum
             _make_tag_file('bag-info.txt', bag_info)
 
diff --git a/setup.py b/setup.py
index e91730d..ee8c326 100644
--- a/setup.py
+++ b/setup.py
@@ -2,6 +2,8 @@ from sys import exit, version
 
 from setuptools import setup
 
+import bagit
+
 if version < '2.6.0':
     print("python 2.6 or higher is required")
     exit(1)
@@ -24,10 +26,11 @@ try:
 except:
     requirements.append("hashlib")
 
+version = bagit.VERSION
 
 setup(
     name = 'bagit',
-    version = '1.5.4',
+    version = version,
     url = 'https://libraryofcongress.github.io/bagit-python/',
     author = 'Ed Summers',
     author_email = 'ehs@pobox.com',

Bag-Software-Agent include version?
It would be nice if the default Bag-Software-Agent had a version in it. Currently it looks like:

    bagit.py <http://github.com/libraryofcongress/bagit-python>

But maybe something like this would be better, for discovering bags created with (gasp) a version of bagit.py that has a bug?

    bagit.py v1.5.3 <http://github.com/libraryofcongress/bagit-python>


diff --git a/test.py b/test.py
index 5dc8fbf..285174c 100644
--- a/test.py
+++ b/test.py
@@ -303,7 +303,7 @@ class TestSingleProcessValidation(unittest.TestCase):
         info = {'Bagging-Date': '1970-01-01', 'Contact-Email': 'ehs@pobox.com'}
         bag = bagit.make_bag(self.tmpdir, checksum=['sha1'], bag_info=info)
         self.assertTrue(os.path.isfile(j(self.tmpdir, 'tagmanifest-sha1.txt')))
-        self.assertEqual(bag.entries['bag-info.txt']['sha1'], 'd7f086508df433e5d7464b5a3835d5501df14404')
+        self.assertEqual(bag.entries['bag-info.txt']['sha1'], 'ec70407d895d4e550bc0a7ea40a82ad653d136e5')
 
     def test_validate_unreadable_file(self):
         bag = bagit.make_bag(self.tmpdir, checksum=["md5"])
@@ -360,7 +360,7 @@ class TestBag(unittest.TestCase):
         self.assertTrue('Contact-Email: ehs@pobox.com' in bag_info_txt)
         self.assertTrue('Bagging-Date: 1970-01-01' in bag_info_txt)
         self.assertTrue('Payload-Oxum: 991765.5' in bag_info_txt)
-        self.assertTrue('Bag-Software-Agent: bagit.py <http://github.com/libraryofcongress/bagit-python>' in bag_info_txt)
+        self.assertTrue('Bag-Software-Agent: bagit.py v1.5.4 <http://github.com/libraryofcongress/bagit-python>' in bag_info_txt)
 
         # check tagmanifest-md5.txt
         self.assertTrue(os.path.isfile(j(self.tmpdir, 'tagmanifest-md5.txt')))
@@ -368,7 +368,7 @@ class TestBag(unittest.TestCase):
             tagmanifest_txt = tm.read()
         self.assertTrue('9e5ad981e0d29adc278f6a294b8c2aca bagit.txt' in tagmanifest_txt)
         self.assertTrue('a0ce6631a2a6d1a88e6d38453ccc72a5 manifest-md5.txt' in tagmanifest_txt)
-        self.assertTrue('6a5090e27cb29d5dda8a0142fbbdf37e bag-info.txt' in tagmanifest_txt)
+        self.assertTrue('bfe59ad8af1a227d27c191b4178c399f bag-info.txt' in tagmanifest_txt)
 
     def test_make_bag_sha1_manifest(self):
         bagit.make_bag(self.tmpdir, checksum=['sha1'])

pip install -e .
parse_log_pytest
pytest
pytest
apt-get update apt-get install -y gcc
3.5
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
-e git+https://github.com/LibraryOfCongress/bagit-python.git@5489148ab1f365fcd518bcbc626a9f84b22640a2#egg=bagit
certifi==2021.5.30
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: bagit-python
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib-metadata=4.8.1=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
prefix: /opt/conda/envs/bagit-python

test.py::TestSingleProcessValidation::test_sha1_tagfile test.py::TestMultiprocessValidation::test_sha1_tagfile test.py::TestBag::test_make_bag
test.py::TestSingleProcessValidation::test_validate_unreadable_file test.py::TestMultiprocessValidation::test_validate_unreadable_file
test.py::TestSingleProcessValidation::test_allow_extraneous_dirs_in_base test.py::TestSingleProcessValidation::test_allow_extraneous_files_in_base test.py::TestSingleProcessValidation::test_bom_in_bagit_txt test.py::TestSingleProcessValidation::test_handle_directory_end_slash_gracefully test.py::TestSingleProcessValidation::test_make_bag_md5_sha1_sha256_manifest test.py::TestSingleProcessValidation::test_make_bag_md5_sha256_manifest test.py::TestSingleProcessValidation::test_make_bag_sha1_sha256_manifest test.py::TestSingleProcessValidation::test_missing_file test.py::TestSingleProcessValidation::test_missing_manifest_raises_error test.py::TestSingleProcessValidation::test_missing_tagfile_raises_error test.py::TestSingleProcessValidation::test_mixed_case_checksums test.py::TestSingleProcessValidation::test_multiple_oxum_values test.py::TestSingleProcessValidation::test_validate_fast test.py::TestSingleProcessValidation::test_validate_fast_without_oxum test.py::TestSingleProcessValidation::test_validate_flipped_bit test.py::TestSingleProcessValidation::test_validate_optional_tagfile test.py::TestSingleProcessValidation::test_validate_optional_tagfile_in_directory test.py::TestSingleProcessValidation::test_validate_slow_without_oxum_extra_file test.py::TestSingleProcessValidation::test_validation_error_details test.py::TestMultiprocessValidation::test_allow_extraneous_dirs_in_base test.py::TestMultiprocessValidation::test_allow_extraneous_files_in_base test.py::TestMultiprocessValidation::test_bom_in_bagit_txt test.py::TestMultiprocessValidation::test_handle_directory_end_slash_gracefully test.py::TestMultiprocessValidation::test_make_bag_md5_sha1_sha256_manifest test.py::TestMultiprocessValidation::test_make_bag_md5_sha256_manifest test.py::TestMultiprocessValidation::test_make_bag_sha1_sha256_manifest test.py::TestMultiprocessValidation::test_missing_file test.py::TestMultiprocessValidation::test_missing_manifest_raises_error test.py::TestMultiprocessValidation::test_missing_tagfile_raises_error test.py::TestMultiprocessValidation::test_mixed_case_checksums test.py::TestMultiprocessValidation::test_multiple_oxum_values test.py::TestMultiprocessValidation::test_validate_fast test.py::TestMultiprocessValidation::test_validate_fast_without_oxum test.py::TestMultiprocessValidation::test_validate_flipped_bit test.py::TestMultiprocessValidation::test_validate_optional_tagfile test.py::TestMultiprocessValidation::test_validate_optional_tagfile_in_directory test.py::TestMultiprocessValidation::test_validate_slow_without_oxum_extra_file test.py::TestMultiprocessValidation::test_validation_error_details test.py::TestBag::test_bag_class test.py::TestBag::test_bag_constructor test.py::TestBag::test_carriage_return_manifest test.py::TestBag::test_default_bagging_date test.py::TestBag::test_garbage_in_bagit_txt test.py::TestBag::test_has_oxum test.py::TestBag::test_is_valid test.py::TestBag::test_make_bag_multiprocessing test.py::TestBag::test_make_bag_sha1_manifest test.py::TestBag::test_make_bag_sha256_manifest test.py::TestBag::test_make_bag_sha512_manifest test.py::TestBag::test_make_bag_unknown_algorithm test.py::TestBag::test_make_bag_with_data_dir_present test.py::TestBag::test_make_bag_with_newline test.py::TestBag::test_missing_tagmanifest_valid test.py::TestBag::test_multiple_meta_values test.py::TestBag::test_payload_permissions test.py::TestBag::test_save_baginfo test.py::TestBag::test_save_baginfo_with_sha1 test.py::TestBag::test_save_manifests test.py::TestBag::test_save_manifests_deleted_files test.py::TestBag::test_save_only_baginfo test.py::TestBag::test_unicode_in_tags
setup.py bagit.py
setup.py bagit.py