Agoraphobia is often comorbid with panic disorder — meaning people often suffer from both conditions at the same time. It's an intense fear of not being able to escape whatever place you're in, and can often lead to an avoidance of leaving the house. People with agoraphobia can fear situations where this anxiety might flare up, and typically don't feel comfortable or safe in public, crowded places.
Panic attacks can occur unexpectedly during a calm state or in an anxious state. Although panic attacks are a defining characteristic of panic disorder, it is not uncommon for individuals to experience panic attacks in the context of other psychological disorders. For example, someone with social anxiety disorder might have a panic attack before giving a talk at a conference and someone with obsessive-compulsive disorder might have a panic attack when prevented from engaging in a ritual or compulsion.