The new SFO international airport is very nice. It's modern and the immigration/customs facilities are fast and efficient.
If you're arriving that late in the day, the queues should be quite fast. You still have to collect your bags and go through customs. But after customs, there is another 'quick' check-in counter where you put your bags there for your flight and get your boarding pass for the AA flight as well.
From the International Terminal, you'd need to take a transfer bus to the AA terminal. But once there, you'd have to go through security again. But bear in mind that if it is a late flight, the terminal might be quite empty and you might passs through quickly.