Date: 202107
Local time of day: 0601-1200
Location: ZZZ.TRACON, US
Flight conditions: VMC
Aircraft: B777 Undifferentiated or Other Model
Operator: Air Carrier
Operating under: Part 121
Flight plan: IFR
Mission: Passenger
Flight phase: Climb
Second aircraft: Small Aircraft; Low Wing; 2 Eng; Retractable Gear
Reporter organization: Air Carrier
Reporter function: Captain; Pilot Flying
Reporter qualification: Flight Crew Multiengine; Flight Crew Instrument; Flight Crew Air Transport Pilot (ATP)
Human factors: Distraction; Time Pressure; Communication Breakdown; Workload
Second reporter function: First Officer; Pilot Not Flying
Anomaly: ATC Issue All Types; Conflict NMAC; Deviation - Altitude Excursion From Assigned Altitude; Deviation / Discrepancy - Procedural Clearance
Detector: Automation Air Traffic Control; Automation Aircraft RA; Automation Aircraft TA; Person Flight Crew
When detected: In-flight
Result: Flight Crew FLC complied w / Automation / Advisory; Flight Crew Took Evasive Action
Contributing factors: Human Factors; Environment - Non Weather Related
Primary problem: Human Factors

Narrative: The Captain was hand flying the aircraft on the ZZZZZ RNAV Departure off of Runway XXR from ZZZ; climbing to FL 190. ATC issued our flight an intermediate level off altitude of 10;000 ft. Approaching 10;000 ft. and about to level off; our flight received a TCAS RA to 'Maintain Vertical Speed;' due to an aircraft that appeared to be descending towards our aircraft and crossing our flight path. The Captain complied with and performed the TCAS RA maneuver. Then; the ATC Controller and what sounded like an ATC Supervisor intervening; issued instructions to the other aircraft to turn and climb immediately. At this point; our flight's TCAS RA changed from a 'Maintain Vertical Speed' to a 'Descend Now.' The Captain complied with the changing 'Descend Now' TCAS RA maneuver. Once the radio communications cleared; the First Officer was able to inform ATC of our TCAS RA. As a result of our TCAS RA maneuvering and the ATC issued turn and climb instructions to the other aircraft; the other aircraft appeared to pass our aircraft forward; above and to the right at less than 500 ft. Our flight then continued to ZZZ1 without further incidence.


Second narrative: Departing ZZZ on the ZZZZZ ZZZZZ1 transition; we were initially cleared to FL190. Passing 8;800 ft.; we were told to stop our climb at 10000 ft. The Captain was hand flying. At 9;800 ft.; we received a 'maintain vertical speed' in a climb RA. ATC gave the conflicting aircraft; a light twin; an immediate climb and turn to the east. The traffic was pointed out to us and I responded; 'Roger. Aircraft X TCAS climb.' I then spotted the aircraft (conditions were VMC) but was unable to tell ATC due to radio congestion. As the conflicting aircraft began to climb away from us; we received a course reversal to 'DESCEND. DESCEND NOW' RA. The Captain followed the guidance. ATC gave us a frequency change and I read back the clearance and added 'TCAS descent' and changed frequencies. I estimate we passed within 500 ft. as the aircraft passed above us and to the right; turning away from us. The flight continued without incident to ZZZ1.


Synopsis: B777 flight crew reported an NMAC during the departure climb