MANAGUA, NICARAGUA, AUG. 12 -- President Daniel Ortega took off on a previously unannounced trip to Cuba today to consult with President Fidel Castro on a Central American peace agreement signed last week.

Ortega told reporters who were summoned to Managua's airport that the trip would be a "working visit" involving discussions about the future of Cuba's military advisers here. Ortega said Nicaragua was ready to participate in a "withdrawal from Central America of all foreign military advisers and all foreign military presence."

According to U.S. estimates, Cuba maintains about 2,500 military and security personnel in Nicaragua to help train and advise the 75,000-member Sandinista Popular Army, the largest in Central America, and the Nicaraguan security and intelligence services, which are modeled on Cuban agencies. In addition, an estimated 2,000 Cuban civilians are said to work in such nonmilitary fields as health and education.

The United States has more than 50 full-time military advisers in El Salvador and maintains a continuous presence of some 1,100 armed forces personnel in Honduras, where frequent joint military exercises often swell that number.

The Central American peace agreement signed Friday in Guatemala City by the presidents of Nicaragua, El Salvador, Honduras, Costa Rica and Honduras does not call for the withdrawal of foreign military advisers or an end to foreign military aid to the region's governments, but speaks of further negotiations for an eventual reduction of the regional arms race.

A draft peace agreement put forward previously by the Contadora Group, consisting of Mexico, Panama, Venezuela and Colombia, explicitly calls for a pullout of foreign military advisers and cessation of military aid to both governments and insurgencies. Although the Guatemala peace agreement praises the Contadora efforts, the Contadora draft is not binding on the five Central American countries.

Nicaraguan Foreign Minister Miguel d'Escoto, traveling with Ortega to Havana, said before boarding the plane that he did not think there would be anything but "positive" political fallout from the trip. He said it was desirable that Cuba be kept "totally informed" of such developments in the region as the peace agreement. Nicaragua and the other Central American signatories "hope that Cuba will actively cooperate" in achieving the goals of the Guatemala peace agreement, d'Escoto said.

The trip to Cuba shows that Nicaragua wants to "gather as much support as we possibly can for the presidential agreement," he added. "This will be another opportunity to reiterate Nicaragua's willingness for total withdrawal of all foreign military personnel from the Central American region."

Ortega said he hoped President Reagan would announce the end of military and logistical support for the Nicaraguan rebels, known as contras, and respond to a Sandinista appeal for direct negotiations with the United States.

He said a peace plan proposed by Reagan last week on the eve of the Central American summit showed that ending the Nicaraguan war "is a bilateral question that should be dealt with by the United States and Nicaragua." Washington has rejected the Sandinista call to resume negotiations.