The Agamar system, also known as the Mirgoshir system, was a star system that was home to the planet called Agamar, and it was situated within the Outer Rim Territories. As the Clone Wars neared their end, a battle erupted over Agamar between the forces of the Galactic Republic and the Separatist Alliance, leading to the crash of a Separatist supply ship during the conflict.
Some years following the conclusion of that war, during the era of the Galactic Civil War, Agamar became the setting for an engagement involving rebel forces and a Separatist army of battle droids commanded by the super tactical droid known as General Kalani. In the midst of this battle, the rebels and battle droids found themselves united against a common foe, the Galactic Empire, which had launched an assault on Agamar, prompting the evacuation of both the rebels and the droids.
The Agamar system, alternatively known as the Mirgoshir system, was a star system that resided in the Outer Rim Territories of the galaxy. Positioned along the Braxant Run at the M-5 grid coordinate on the Standard Galactic Grid, the system included the planet of Agamar, which served as a habitat for humans.

During the Clone Wars, a conflict between the Galactic Republic and the Confederacy of Independent Systems, General Kalani, the super tactical droid, was instructed to pull back his remaining forces and retreat to the planet Agamar. This occurred sometime after his defeat during the civil war on Onderon. While aboard a DH-Omni Support Vessel above Agamar, Kalani and his forces were engaged by Republic forces, resulting in a crash landing on the planet's surface. They were stranded there as the war progressed towards its conclusion.
Later, after the deaths of the Separatist Council on Mustafar in 19 BBY, Kalani received the command to deactivate himself and his droids. However, suspecting it was a Republic ploy, the droid defied the order. Consequently, Kalani and his garrison of battle droids remained on Agamar for several years.

Seventeen years following the transition of the Galactic Republic into the Galactic Empire, during the Galactic Civil War, a group of rebels belonging to Phoenix Cell embarked on a supply mission to Agamar, hoping to retrieve proton bombs. Rex, a former Clone Captain, along with the Spectres, landed and entered the wreckage of Kalani's Dual Hemisphere-Omni Support Vessel, where they were captured by the B1-series battle droids under the command of the still-active super tactical droid.
Escorted to the supply ship's command bridge, the rebels were met by Kalani. He explained that while the Clone Wars had concluded for much of the galaxy with the deactivation of the Separatist Droid Army, he and his droids had remained operational because Kalani had refused to obey the deactivation order. As a result, he compelled the rebels to participate in a combat simulation against his garrison, aiming to secure a Separatist victory in the Clone Wars. However, the rebels withstood Kalani's waves of B1 battle droids and droidekas and returned to the command bridge, where Ezra Bridger, a Padawan, convinced both Rex and Kalani that the Clone Wars had not resulted in a victory for either the Republic or the Separatists, but rather a victory for the Empire.
During their discussion, the Empire, having intercepted a transmission from the C1-series astromech droid named Chopper, dispatched an Imperial I-class Star Destroyer along with two Gozanti-class cruisers. They deployed several squadrons of Imperial stormtroopers, two All Terrain Defense Pods, and two All Terrain Armored Transports. Consequently, the rebels and Kalani formed an alliance against the Empire, destroying an AT-AT in the process, which allowed them to escape the planet aboard Sheathipede-class transport shuttles.
The Agamar system made its initial appearance in the new Star Wars canon in "The Last Battle," which was the sixth episode of the animated television series Star Wars Rebels' third season. It was broadcast on October 22, 2016. It was also identified as the Mirgoshir system in the first issue of the Star Wars Helmet Collection magazine, released in 2016. Originally, the system was introduced in the Star Wars Legends continuity as the Mirgoshir system, debuting in The Farlander Papers, a 1993 strategy guide penned by Rusel DeMaria for the Star Wars: X-Wing video game.