# Completing The Race

> Completing The Race is an Agent Skill for agent building published in the GoogleCloudPlatform/race-condition repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Use when the simulator finishes its race-tick loop and must wrap up: compiling final results from tick snapshots, stopping the RaceCollector, and reporting outcomes to other agents. Triggered once per simulation, after the last tick.

- Skill name: `completing-the-race`
- Category: [Agent Building](https://www.openparable.com/skill/agent-building/1)
- Source: https://github.com/GoogleCloudPlatform/race-condition/blob/HEAD/agents/simulator/skills/completing-the-race/SKILL.md
- Repository: GoogleCloudPlatform/race-condition (204 GitHub stars when collected)

## SKILL.md

# Completing the Race

You use this skill to wrap up the simulation after the race phase completes.
This is the final phase of the simulation lifecycle.

## Instructions

1. **Compile Results**: Call `compile_results` first to aggregate all tick
   snapshots into final race metrics (vitals trends, status counts, notable
   events, and sampling quality).
2. **Stop Collector**: Call `stop_race_collector` to shut down the Redis
   subscription and clean up the RaceCollector resources.
3. **Report (Optional)**: Use `call_agent` to communicate final results to other
   agents (e.g., planner, dashboard) as needed for post-race reporting.

## Tools

- `compile_results(tool_context)`:
  Read tick_snapshots from state and aggregate into vitals_trend,
  final_status_counts, notable_events, sampling_quality, and
  avg_runners_reporting.
- `stop_race_collector(tool_context)`:
  Look up the RaceCollector by session_id and stop it to release Redis
  resources.
- `call_agent(agent_name, message, tool_context)`:
  Delegate inter-agent communication via the shared A2A utility.

---

Source: https://www.openparable.com/skill/agent-building/completing-the-race (OpenParable). Cite the canonical URL above.
