This paper describes an agent-based model for analyzing the vulnerability of the financial system to asset- and funding-based fire sales. The model views the dynamic interactions of agents in the financial system extending from the suppliers of funding through the intermediation and transformation functions of the bank/dealer to the financial institutions that use the funds to trade in the asset markets, and that pass collateral in the opposite direction. The model focuses on the intermediation functions of the bank/dealers in order to trace the path of shocks that come from sudden price declines, as well as shocks that come from the various agents, namely funding restrictions imposed by the cash providers, erosion of the credit of the bank/dealers, and investor redemptions by the buy-side financial institutions. The model demonstrates that it is the reaction to initial losses rather than the losses themselves that determine the extent of a crisis. By building on a detailed mapping of the transformations and dynamics of the financial system, the agentbased model provides an avenue toward risk management that can illuminate the pathways for the propagation of key crisis dynamics such as fire sales and funding runs.