The way a single ticket with flights on two different airlines works is that the entire ticket is issued by one of the airlines -- say, A1. The airlines then have an interline agreement that allows A1 to sell legs on B1's flight at the fares and conditions that B1 publishes.
(This is different from a codeshare agreement, where A1 has the right to sell seats on some of B1's airplanes but where A1 sets the fares and tickets them mostly like seats on native A1 flights).
Interlining agreements are much more common than codeshares and generally exist between most pairs of full-service airlines whose route networks meet, irrespective of alliances.
What travel agents have is a reseller agreement with A1 that allows them to resell the combined A1+B1 tickets that A1 issues. The travel agent's computers plug into A1's sales system (usually through an intermediary called a Global Distribution System) at a lower level than the airline's own website, so they can book such a combined ticket through it.
Even though A1 can sell combined tickets, they will usually not have designed their website to make such sales beyond alliance boundaries. That's a marketing decision; they don't want to confuse online customers with the opportunity to book connections on their competitors' flights -- and customers who do need complex connections typically use travel agents anyway.
What this means for you: If you can find a physical ticket counter for either airline A1 or airline B1, they will generally be able to sell you a ticket for your entire combined itinerary at the same fares that you could get the combined itinerary for at a travel agent (which might not always be the cheapest fare either of the two airlines will sell their half for alone). Whether they're willing to do so is a different matter, but if the airline keeps a manned ticket counter open in the first place I would think the chance is pretty good.
I'm not sure why you would want it to do it that way, though. You're not going to get the ticket significantly cheaper directly from the airline (if you don't use their online sales channel that doesn't do interlining); they will just keep the commission they would otherwise pay the travel agent, and possibly even add an issuing fee of their own. In fact, some airline ticket counters are technically just travel agencies that happen to be owned by an airline and carry their branding.