BEIJING — China and India sounded a new optimistic tone in their relationship Wednesday as they signed an agreement to boost meetings between their militaries to avoid any repeat of a tense standoff this year along their disputed Himalayan border.

The accord followed a meeting in Beijing between Chinese Premier Li Keqiang and visiting Indian Prime Minister Manmohan Singh, who also had trade ties on the agenda as India seeks to gain greater access to Chinese markets and readjust a trade balance tilted heavily toward China.

The two sides agreed to boost communication about border maneuvers, hold periodic meetings at designated crossing points, and have patrols refrain from any provocations. They agreed that patrols should not follow or “tail” patrols of the other side in contested areas.