Is there some way to programmatically extract the current consensus of the transaction fee from the bitcoin network, either by using the daemon or through some other means?
Check the medium fee of last n blocks? I believe the transaction fee is currently not very variable. The reference implementation "ensures" that all transactions that are smaller than 1000 bytes, have all outputs over 0,01 BTC and have a large enough priority will be processed, regardless of the transaction fee. Otherwise 0.1 mBTC is paid for every 1000 bytes of transaction (rounded up).
The priority of a transaction can be calculated by 
priority = sum(input_value_in_base_units * input_age) / size_in_bytes